Skip to content

Commit e864797

Browse files
authored
Merge pull request #424 from troettinger/master
Add Option to use AzCopy
2 parents 41b56a1 + a5a5866 commit e864797

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

Syndication/AzureStack.MarketplaceSyndication.psm1

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,23 @@ function Sync-AzSOfflineMarketplaceItem {
140140
New-Item "$destination\$azpkgName.azpkg"
141141
}
142142
$azpkgdestination = "$destination\$azpkgName.azpkg"
143-
(New-Object System.Net.WebClient).DownloadFile("$azpkgsource",$azpkgdestination)
144-
145143

144+
#Select Premium Download
145+
$a = new-object -comobject wscript.shell
146+
$intAnswer = $a.popup("Would yuu like to use Premium download? This requires Azure Storage Tools to be installed", `
147+
0, "Premium Download", 4)
148+
If ($intAnswer -eq 6) {
149+
($checktool= test-path 'C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe' )
150+
If ($checktool -eq $true){
151+
& 'C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe' /Source:$azpkgsource /Dest:$azpkgdestination /Y
152+
}
153+
else{
154+
$a.popup("Please install Azure Storage Tools first, canceling")
155+
}
156+
157+
} else {
158+
{(New-Object System.Net.WebClient).DownloadFile("$azpkgsource",$azpkgdestination) }
159+
}
146160

147161
switch ($downloadDetails.productKind) {
148162
'virtualMachine' {
@@ -156,7 +170,20 @@ function Sync-AzSOfflineMarketplaceItem {
156170
New-Item "$destination\$vhdName.vhd"
157171
}
158172
$vhdDestination = "$destination\$vhdName.vhd"
159-
(New-Object System.Net.WebClient).DownloadFile("$vhdsource",$vhddestination)
173+
174+
#Select Premium Download
175+
$a = new-object -comobject wscript.shell
176+
$intAnswer = $a.popup("Would yuu like to use Premium download? This requires Azure Storage Tools to be installed", `
177+
0, "Premium Download", 4)
178+
If ($intAnswer -eq 6) {
179+
($checktool= test-path 'C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe' )
180+
If ($checktool -eq $true){
181+
& 'C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe' /Source:$vhdsource /Dest:$vhddestination /Y
182+
}
183+
else{
184+
$a.popup("Please install Azure Storage Tools first,canceling")
185+
}
186+
}else{(New-Object System.Net.WebClient).DownloadFile("$vhdsource",$vhddestination) }
160187
}
161188
}
162189
'virtualMachineExtension' {
@@ -169,8 +196,19 @@ function Sync-AzSOfflineMarketplaceItem {
169196
New-Item "$destination\$zipName.zip"
170197
}
171198
$zipDestination = "$destination\$zipName.zip"
172-
173-
Start-BitsTransfer -source $zipsource -destination $zipDestination -Priority High
199+
#Select Premium Download
200+
$a = new-object -comobject wscript.shell
201+
$intAnswer = $a.popup("Would yuu like to use Premium download? This requires Azure Storage Tools to be installed", `
202+
0, "Premium Download", 4)
203+
If ($intAnswer -eq 6) {
204+
($checktool= test-path 'C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe' )
205+
If ($checktool -eq $true){
206+
& 'C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe' /Source:$zipsource /Dest:$zipdestination /Y
207+
}
208+
else{
209+
$a.popup("Please install Azure Storage Tools first,canceling")
210+
}
211+
}else{(New-Object System.Net.WebClient).DownloadFile("$zipsource",$zipdestination)}
174212
}
175213
}
176214

0 commit comments

Comments
 (0)