BITS を使用して OneDrive にファイルを送信しようとしています。これに関する記事を見つけました: https://msdn.microsoft.com/en-us/library/dn858877.aspx ; しかし、PowerShell のネイティブStart-BitsTransfer
メソッドによって労力を節約できることを期待していました。ただし、その記事は、OneDrive が BITS アップロードをサポートしていることを暗示しています。物事は有望です。
$source = '\\myFileServer\Backups\SqlServerDbBackup.bak' #3.2GB file
$destination = 'https://myCompany.sharepoint.com/personal/my_account/Documents/SqlServerDbBackup.bak'
$cred = get-credential #here I enter the same credentials I use to access the site
Start-BitsTransfer -Source $source -Destination $destination -TransferType Upload -Credential $cred
上記のコードを実行すると、進行状況バーが一時的にポップアップし、エラーが表示されます。以下の完全な出力 (資格情報プロンプトを含む):
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Start-BitsTransfer : HTTP status 501: The server does not support the functionality required to fulfill the request.
At line:8 char:1
+ Start-BitsTransfer -Source $source -Destination $destination -TransferType Uploa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-BitsTransfer], Exception
+ FullyQualifiedErrorId : StartBitsTransferCOMException,Microsoft.BackgroundIntelligentTransfer.Management.NewBitsTransferCommand
を使用して OneDrive へのアップロードを実行できるかどうか、以前に誰かがこれを試みたことがありstart-bitstransfer
ますか?