![](/img/trans.png)
[英]Downloading files with powershell 2.0 on windows 7 - From Microsoft
[英]Uploading and downloading files from Azure to Windows using PowerShell
我正在編寫PowerShell腳本以與我的Microsoft Azure帳戶進行通信,並且使用Set-AzureStorageBlobContent和Get-AzureStorageBlobContent模塊上載和下載文件時遇到了問題。
$Upload = @{
Context = $storageContext;
Container = $container;
File = "C:\... \file.csv";
}
Set-AzureStorageBlobContent @Upload -Force;
我第一次運行此程序,它似乎開始上傳,但它始終保持在0%且從未升高。 如果取消它並再次嘗試執行腳本,則會收到一條錯誤消息:“ Set-AzureStorageBlobContent:具有相同源和目標的傳輸操作已存在。” 當我嘗試從Azure下載現有的Blob時,發生了幾乎相同的事情。
$params = @{
Context = $storageContext;
Container = $container;
Blob = $blob;
Destination = $dest
}
New-Item -Path $dest -ItemType Directory -Force
Get-AzureStorageBlobContent @params
我嘗試重新安裝Azure.Storage,它是包含cmdlet Get-AzureStorageBlobContent和Set-AzureStorageBlobContent的模塊,但是我沒有運氣。 我做錯了什么,還是這段代碼是錯誤的?
$ Upload變量似乎與某物有關。 嘗試以下方法:
Get-ChildItem –Path C:\Images\* | Set-AzureStorageBlobContent -Container "yourcontainername"
更多信息: https : //docs.microsoft.com/zh-cn/azure/storage/storage-powershell-guide-full
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.