Start-BitsTransfer failing to send files to remote destination
I am using the following command to send local files to a remote location that is mapped on my F drive:
Start-BitsTransfer -Source C:\Source\*.* -Destination F:\Destination -Description "Backing up files to remote destination" -DisplayName "Full Backup $((Get-Date).ToString('yyyy-MM-dd'))" -TransferType Download
My upload is failing when the progress is about 70%.
This is the error I am getting:
Start-BitsTransfer : Invalid Signature.
At C:\backup\MyBackUp.ps1:65 char:2
+ Start-BitsTransfer -Source C:\Source\*.* -Destination F:\Destination\ -Des ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-BitsTransfer], Exception
+ FullyQualifiedErrorId : StartBitsTransferCOMException,Microsoft.BackgroundIntelligentTransfer.Management.NewBitsTransferCommand
Any suggestion or recommendation?
Thank you.
The Start-BitsTransfer command may not be the best choice here, as its documentation says:
The Start-BitsTransfer cmdlet supports the download of multiple files from a server to a client computer, but it does not generally support the upload of multiple files from a client computer to a server. If you need to upload more than one file, you can use the Import-Csv cmdlet to pipe the output to the Add-BitsFile cmdlet to upload multiple files. Or, if you need to upload more than one file, consider a cabinet file (.cab) or a compressed file (.zip).
The documentation also says the following (which I suspect is wrong):
When you upload files to an HTTP location, the TransferType parameter must be set to Upload.
The error message "Invalid Signature" might be returned because the credential used by the server is not accepted, for example if it's self-signed.
Your might be able to use the -SecurityFlags
parameter to disable
the error, but the parameters are not explained at all in the
documentation. The following might be helpful:
IgnoreCertCNInvalid, IgnoreCertDateInvalid, IgnoreUnknownCA,
IgnoreCertWrongUsage.
As an alternative, you could use instead the WebClient.UploadFile Method, which does not check certificates.