2

I am typing the following command in a PowerShell prompt:

Start-BitsTransfer -Source "\\serverA\c$\test.txt" -Destination . -TransferType Download -cred (get-credential)

After typing the credentials correctly, I get:

Cannot find path "\\serverA\c$\test.txt" because it does not exist

I can map \\serverA\c$ to a network drive (e.g. Y:\) and then the following works:

Start-BitsTransfer -Source "Y:\\test.txt" -Destination . -TransferType Download

But this is not desirable because I need the capability to be able to download files from more than 26 servers at a time, which means I'll run out of drive letters.

4
  • Can you run the command in the context of a user account that already has permission to the remote C$ share? Dec 10, 2018 at 19:47
  • It may be more straightforward to perform this transfer from the other direction instead, running it on the destination machines. Dec 10, 2018 at 19:55
  • @TwistyImpersonator Unfortunately the users won't have access to such an account. Dec 11, 2018 at 17:57
  • @ChristopherHostage Due to a complex (corporate) network topology, I don't think this'll be possible. Dec 11, 2018 at 18:00

1 Answer 1

3

The New-PSDrive command can create temporary drive mappings within the shell which can be named as any string. Since I do not need these drives to persist, this is a good solution for me, and the -Credential parameter is not bugged (like it is with start-bitstransfer).

New-PSDrive -name "drive1" -PSProvider "FileSystem" -Root "\\serverA\c$" -cred $cred
Start-BitsTransfer -Source "drive1:\\test.txt" -Destination .

This works fine and there's no (unreasonable) limit to the number of temporary drive mappings you can create. For more info about New-PSDrive, see https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-psdrive?view=powershell-6

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .