Scripting AzCopy for automated upload


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

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

Please share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.