Scripting AzCopy for automated upload

Sending
User Review
0 (0 votes)

Tech Wizard

Today we will discuss how we can use powershell & script the azcopy to upload the files to azure.

This can be used for office 365 pst imports or other work that you do.

Here is the Code Snippet from one of my office 365 scripts to upload archives & also do error checking.

#################Azure Upload#################
$log1= $log[1]
Write-Host “Channging directory to azcopy” -ForegroundColor Green
cd “C:Program Files (x86)Microsoft SDKsAzureazcopy”
$azcopy = .AzCopy.exe /Source:$source /Dest:$SASurl /V:$log1 2>&1
Write-Host “Azcopy finsihed – check logs” -foregroundcolor Green
ProgressBar -Title “Azcopy finsihed – check logs” -Timer 10
$azcount = select-string -Pattern “Total files transferred” $log1
$az=$azcount -split “: ”
if ($az[1] -ne $count)
{
Write-Host “$az[1] and $count are not equal” -ForegroundColor Red
Add-Content $log[1] “$az[1] and $count are not equal Check WI for further instructions”
ProgressBar -Title “$az[1] and $count are not equal Check WI for further instructions – Exit” -Timer 10

View original post 213 more words

Leave a Reply