I'm using Start-BITSTransfer
to download a file from the internet and place it in a network location. The location is similar to \\computername\c$\folder
which the cmdlet says it can't find and that it doesn't exist.
To get Test-Path
to pass successfully you have to add the filesystem provider to the location like this: filesystem::\\computername\c$\folder
. The rub is that Start-BITSTransfer
doesn't like destinations with the filesystem provider declared and errors with "The path is not of a legal form".
The problem is further compounded by the inability to use Invoke-Command
and run the code in a remote shell on the destination server. Start-BITSTransfer
blocks this usage.
What's the solution to using Start-BITSTransfer
with a network location?
To solve this I had to change my location from the CMSite provider drive
CMSite:\
to a filesystem provider drivecd c:
and then initiate the BITS Transfer. Apparently the CMSite provider doesn't inherit this operation.