I am currently writing a script that requires copying a file from another machine using a different credential
I followed the step here
Using PowerShell credentials without being prompted for a password
It didn't work for me, when I run Start-BitsTransfer the command prompt still complains that the file I need to copy does not exist
I noticed that if I try and browse the directory I want to copy from and enter the credential when prompted, I was able to copy the file from then on because the credential is somehow cached
I also noticed that the prompt I mentioned above look a bit different from the prompt I would have gotten using "Get-Credential" command
Not sure if that means anything. Anyway, why didn't the solution I found work for me? Any Ideas?
P.S.
Start-BitsTransfer -Source \\RemoteFS\RemoteFile -Destination . -Credential $fsCred
Start-BitsTransfer : Cannot find path '\\RemoteFS\RemoteFile' because it does not exist.
At line:1 char:1
+ Start-BitsTransfer -Source \\RemoteFS\RemoteFile -Destinatio ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\\RemoteFS\RemoteFile:String) [Start-BitsTransfer], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.BackgroundIntelligentTransfer.Management.NewBitsTransferCommand
Note that, again, after I try and access \RemoteFS\RemoteFile in file explorer and got prompted for credential I was able to run the command just fine because the credential is cached I think