Skip to content

Commit d33500f

Browse files
bottkarsknithinc
authored andcommitted
Update AzureStack.ComputeAdmin.psm1 (#427)
added latest windows update http://download.windowsupdate.com/d/msdownload/update/software/updt/2018/05/windows10.0-kb4103720-x64_c1fb7676d38fffae5c28b9216220c1f033ce26ac.msu added SKU Version Object calculation based upon date $SKUVersion (autofilled for downstream compat )
1 parent 0064fc1 commit d33500f

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

ComputeAdmin/AzureStack.ComputeAdmin.psm1

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ function Remove-AzsVMImage {
350350

351351
$VMImageExists = $false
352352
if (Get-AzsVMImage -publisher $publisher -offer $offer -sku $sku -version $version -location $location -ErrorAction SilentlyContinue) {
353-
Write-Verbose "VM Image is present in Azure Stack - continuing to remove" -Verbose
353+
Write-Verbose "VM Image is present in Azure Stack - continuing to remove"
354354
$VMImageExists = $true
355355
}
356356
else {
@@ -367,7 +367,7 @@ function Remove-AzsVMImage {
367367
ApiVersion = "2015-12-01-preview"
368368
}
369369

370-
Write-Verbose -Message "Deleting VM Image" -Verbose
370+
Write-Verbose -Message "Deleting VM Image"
371371
Remove-AzureRmResource @params -Force
372372
}
373373
catch {
@@ -377,7 +377,7 @@ function Remove-AzsVMImage {
377377
}
378378

379379
if (-not $KeepMarketplaceItem) {
380-
Write-Verbose "Removing the marketplace item for the VM Image." -Verbose
380+
Write-Verbose "Removing the marketplace item for the VM Image."
381381
$name = "$offer$sku"
382382
#Remove periods so that the offer and sku can be retrieved from the Marketplace Item name
383383
$name = $name -replace "\.", "-"
@@ -470,7 +470,10 @@ function New-AzsServer2016VMImage {
470470
[bool] $CreateGalleryItem = $true,
471471

472472
[Parameter()]
473-
[bool] $Net35 = $true
473+
[bool] $Net35 = $true,
474+
475+
[Parameter()][alias('sku_version')]
476+
[version]$osImageSkuVersion = (date -Format yyyy.MM.dd).ToString()
474477
)
475478
begin {
476479
function CreateWindowsVHD {
@@ -560,7 +563,7 @@ function New-AzsServer2016VMImage {
560563
process {
561564

562565
$location = Get-AzsHomeLocation -Location $location
563-
Write-Verbose -Message "Checking ISO path for a valid ISO." -Verbose
566+
Write-Verbose -Message "Checking ISO path for a valid ISO."
564567
if (!$IsoPath.ToLower().contains('.iso')) {
565568
Write-Error -Message "ISO path is not a valid ISO file." -ErrorAction Stop
566569
}
@@ -589,7 +592,7 @@ function New-AzsServer2016VMImage {
589592
else {
590593
if ($IncludeLatestCU) {
591594
#for latest CU, check https://support.microsoft.com/en-us/help/4000825/windows-10-and-windows-server-2016-update-history
592-
$Uri = 'http://download.windowsupdate.com/c/msdownload/update/software/secu/2017/10/windows10.0-kb4041691-x64_6b578432462f6bec9b4c903b3119d437ef32eb29.msu'
595+
$Uri = 'http://download.windowsupdate.com/d/msdownload/update/software/updt/2018/05/windows10.0-kb4103720-x64_c1fb7676d38fffae5c28b9216220c1f033ce26ac.msu'
593596
$OutFile = "$ModulePath\update.msu"
594597
}
595598
else {
@@ -605,7 +608,7 @@ function New-AzsServer2016VMImage {
605608
}
606609
$CurrentProgressPref = $ProgressPreference
607610
$ProgressPreference = 'SilentlyContinue'
608-
Write-Verbose -Message "Starting download of CU. This will take some time." -Verbose
611+
Write-Verbose -Message "Starting download of CU. This will take some time."
609612
Invoke-WebRequest -Uri $Uri -OutFile $OutFile -UseBasicParsing
610613
$ProgressPreference = $CurrentProgressPref
611614
Unblock-File -Path $OutFile
@@ -629,7 +632,7 @@ function New-AzsServer2016VMImage {
629632
$PublishArguments = @{
630633
publisher = 'MicrosoftWindowsServer'
631634
offer = 'WindowsServer'
632-
version = '1.0.0'
635+
version = $osImageSkuVersion.ToString()
633636
osType = 'Windows'
634637
location = $location
635638
}
@@ -649,7 +652,7 @@ function New-AzsServer2016VMImage {
649652
try {
650653
if ((!(Test-Path -Path $ImagePath)) -and (!$VMImageAlreadyAvailable)) {
651654
Write-Verbose -Message "Creating Server Core Image"
652-
CreateWindowsVHD @ConvertParams -VHDPath $ImagePath -Edition $CoreEdition -ErrorAction Stop -Verbose
655+
CreateWindowsVHD @ConvertParams -VHDPath $ImagePath -Edition $CoreEdition -ErrorAction Stop
653656
}
654657
else {
655658
Write-Verbose -Message "Server Core VHD already found."
@@ -683,8 +686,8 @@ function New-AzsServer2016VMImage {
683686
}
684687

685688
if ((!(Test-Path -Path $ImagePath)) -and (!$VMImageAlreadyAvailable)) {
686-
Write-Verbose -Message "Creating Server Full Image" -Verbose
687-
CreateWindowsVHD @ConvertParams -VHDPath $ImagePath -Edition $FullEdition -ErrorAction Stop -Verbose
689+
Write-Verbose -Message "Creating Server Full Image"
690+
CreateWindowsVHD @ConvertParams -VHDPath $ImagePath -Edition $FullEdition -ErrorAction Stop
688691
}
689692
else {
690693
Write-Verbose -Message "Server Full VHD already found."
@@ -718,7 +721,7 @@ Function CreateGalleryItem {
718721
[ValidatePattern("[a-zA-Z0-9-]{3,}")]
719722
[String] $Offer,
720723

721-
[ValidatePattern("[a-zA-Z0-9-]{3,}")]
724+
[ValidatePattern("[a-zA-Z0-9-\.]{3,}")]
722725
[String] $Sku,
723726

724727
[ValidatePattern("\d+\.\d+\.\d")]
@@ -743,7 +746,7 @@ Function CreateGalleryItem {
743746
$maxAttempts = 5
744747
for ($retryAttempts = 1; $retryAttempts -le $maxAttempts; $retryAttempts++) {
745748
try {
746-
Write-Verbose -Message "Downloading Azure Stack Marketplace Item Generator Attempt $retryAttempts" -Verbose
749+
Write-Verbose -Message "Downloading Azure Stack Marketplace Item Generator Attempt $retryAttempts"
747750
Invoke-WebRequest -Uri http://www.aka.ms/azurestackmarketplaceitem -OutFile "$workdir\MarketplaceItem.zip"
748751
break
749752
}

0 commit comments

Comments
 (0)