Skip to content

Commit 8d59a54

Browse files
authored
Dev (#582)
* Update DownloadLatestCUs.ps1 added Azure Stack HCI 23H2 CU and Servicing Stack in a new PR we should remove SSU as they are now part of the CU for all supported releases of Windows Server and Client AFTER 1607 ref: https://www.catalog.update.microsoft.com/Search.aspx?q=servicing%20stack * Update DownloadLatestCUs.ps1 1. added support for Windows Server 11 23H2 2. added support for Azure Stack HCI 23H2 3. removed "," in Searchstring for consistency, -like is used later on 4. changed SSUSearchString to $null where appropriate (no SSU exist for these releases. left it for older ones, even though latest CUs would have them included. 5. added if else to support $null SSUSearchString notes: for some reason 23H2 releases do not download files even they are correctly found and listed. Problem with the used module Get-MSCatalogUpdate? * cloud deploy update
1 parent 182faf0 commit 8d59a54

2 files changed

Lines changed: 58 additions & 33 deletions

File tree

Scenarios/AzSHCI and Cloud Based Deployment/Scenario.ps1

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
11
#region Prepare Active Directory
22
$AsHCIOUName="OU=ASClus01,DC=Corp,DC=contoso,DC=com"
3-
$Servers="ASNode1","ASNode2"
4-
$DomainFQDN=$env:USERDNSDOMAIN
5-
$ClusterName="ASClus01"
6-
$Prefix="ASClus01"
7-
$UserName="ASClus01-DeployUser"
8-
$Password="LS1setup!LS1setup!"
9-
$SecuredPassword = ConvertTo-SecureString $password -AsPlainText -Force
10-
$Credentials= New-Object System.Management.Automation.PSCredential ($UserName,$SecuredPassword)
3+
#$Servers="ASNode1","ASNode2"
4+
#$DomainFQDN=$env:USERDNSDOMAIN
5+
#$ClusterName="ASClus01"
6+
#$Prefix="ASClus01"
7+
$LCMUserName="ASClus01-LCMUser"
8+
$LCMPassword="LS1setup!LS1setup!"
9+
$SecuredPassword = ConvertTo-SecureString $LCMPassword -AsPlainText -Force
10+
$LCMCredentials= New-Object System.Management.Automation.PSCredential ($LCMUserName,$SecuredPassword)
1111

1212
#install posh module for prestaging Active Directory
1313
Install-PackageProvider -Name NuGet -Force
1414
Install-Module AsHciADArtifactsPreCreationTool -Repository PSGallery -Force
1515

16-
#add KDS Root Key
17-
if (-not (Get-KdsRootKey)){
18-
Add-KdsRootKey -EffectiveTime ((Get-Date).addhours(-10))
19-
}
20-
2116
#make sure active directory module and GPMC is installed
2217
Install-WindowsFeature -Name RSAT-AD-PowerShell,GPMC
2318

2419
#populate objects
25-
New-HciAdObjectsPreCreation -Deploy -AzureStackLCMUserCredential $Credentials -AsHciOUName $AsHCIOUName -AsHciPhysicalNodeList $Servers -DomainFQDN $DomainFQDN -AsHciClusterName $ClusterName -AsHciDeploymentPrefix $Prefix
26-
20+
New-HciAdObjectsPreCreation -AzureStackLCMUserCredential $LCMCredentials -AsHciOUName $AsHCIOUName
21+
2722
#install management features to explore cluster,settings...
2823
Install-WindowsFeature -Name "RSAT-ADDS","RSAT-Clustering"
2924
#endregion
@@ -140,7 +135,7 @@
140135
"Microsoft.ExtendedLocation/register/action",
141136
"Microsoft.HybridContainerService/register/action",
142137
"Microsoft.ResourceConnector/appliances/write",
143-
"Microsoft.ResourceConnector/appliances/delete,
138+
"Microsoft.ResourceConnector/appliances/delete",
144139
"Microsoft.ResourceConnector/appliances/listClusterUserCredential/action",
145140
"Microsoft.ResourceConnector/appliances/read",
146141
"Microsoft.ExtendedLocation/customLocations/read",
@@ -284,6 +279,13 @@
284279
Install-Module -Name az.accounts -Force
285280
} -Credential $Credentials
286281

282+
#make sure resource providers are registered
283+
Register-AzResourceProvider -ProviderNamespace "Microsoft.HybridCompute"
284+
Register-AzResourceProvider -ProviderNamespace "Microsoft.GuestConfiguration"
285+
Register-AzResourceProvider -ProviderNamespace "Microsoft.HybridConnectivity"
286+
Register-AzResourceProvider -ProviderNamespace "Microsoft.AzureStackHCI"
287+
288+
287289
#deploy ARC Agent with device authentication
288290
$ARMtoken = (Get-AzAccessToken).Token
289291
$id = (Get-AzContext).Account.Id
@@ -390,7 +392,7 @@
390392
}
391393
Write-Host "." -NoNewline
392394
} until (
393-
$status.provisioningstate -notcontains "Creatingg"
395+
$status.provisioningstate -notcontains "Creating"
394396
)
395397
396398
#Assign role to ARC Objects
@@ -432,6 +434,22 @@
432434
#endregion
433435

434436
#region final touches
437+
#make sure NTP server is configured
438+
#note make sure integration service is disabled on host if running in VMs
439+
#Get-VM *ASNode* | Disable-VMIntegrationService -Name "Time Synchronization"
440+
441+
$NTPServer="DC.corp.contoso.com"
442+
Invoke-Command -ComputerName $servers -ScriptBlock {
443+
w32tm /config /manualpeerlist:$using:NTPServer /syncfromflags:manual /update
444+
Restart-Service w32time
445+
} -Credential $Credentials
446+
447+
Start-Sleep 20
448+
449+
#check if source is NTP Server
450+
Invoke-Command -ComputerName $servers -ScriptBlock {
451+
w32tm /query /source
452+
} -Credential $Credentials
435453

436454
#make sure there is only one management NIC with IP address (setup is complaining about multiple gateways)
437455
Invoke-Command -ComputerName $servers -ScriptBlock {

Tools/DownloadLatestCUs.ps1

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,18 @@ if ($version.Minor -eq 27){
3939
}
4040

4141
$Products=@()
42-
$Products+=@{Product="Azure Stack HCI 22H2" ;SearchString="Cumulative Update for Microsoft server operating system, version 22H2 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Microsoft server operating system version 22H2 for x64-based Systems" ; ID="Microsoft Server operating system-22H2"}
43-
$Products+=@{Product="Azure Stack HCI 21H2 and Windows Server 2022" ;SearchString="Cumulative Update for Microsoft server operating system version 21H2 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Microsoft server operating system version 21H2 for x64-based Systems" ; ID="Microsoft Server operating system-21H2"}
44-
$Products+=@{Product="Azure Stack HCI 20H2" ;SearchString="Cumulative Update for Azure Stack HCI, version 20H2" ;SSUSearchString="Servicing Stack Update for Azure Stack HCI, version 20H2 for x64-based Systems" ; ID="Azure Stack HCI"}
45-
$Products+=@{Product="Windows Server 2019" ;SearchString="Cumulative Update for Windows Server 2019 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows Server 2019 for x64-based Systems" ; ID="Windows Server 2019"}
46-
$Products+=@{Product="Windows Server 2016" ;SearchString="Cumulative Update for Windows Server 2016 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows Server 2016 for x64-based Systems" ; ID="Windows Server 2016"}
47-
$Products+=@{Product="Windows 11 22H2" ;SearchString="Cumulative Update for Windows 11 Version 22H2 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows 11 Version 22H2 for x64-based Systems" ; ID="Windows 11"}
48-
$Products+=@{Product="Windows 10 21H2" ;SearchString="Cumulative Update for Windows 10 Version 21H2 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows 10 Version 21H2 for x64-based Systems" ; ID="Windows 10, version 1903 and later, Windows 10 LTSB"}
49-
$Products+=@{Product="Windows 10 20H2" ;SearchString="Cumulative Update for Windows 10 Version 20H2 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows 10 Version 20H2 for x64-based Systems" ; ID="Windows 10, version 1903 and later"}
50-
$Products+=@{Product="Windows 10 2004" ;SearchString="Cumulative Update for Windows 10 Version 2004 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows 10 Version 2004 for x64-based Systems" ; ID="Windows 10, version 1903 and later"}
51-
$Products+=@{Product="Windows 10 1909" ;SearchString="Cumulative Update for Windows 10 Version 1909 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows 10 Version 1909 for x64-based Systems" ; ID="Windows 10, version 1903 and later"}
42+
$Products+=@{Product="Azure Stack HCI 23H2" ;SearchString="Cumulative Update for Microsoft server operating system version 23H2 for x64-based Systems" ;SSUSearchString=$null ; ID="Microsoft Server operating system-23H2"} #MSFT really removed the ',' in CUs
43+
$Products+=@{Product="Azure Stack HCI 22H2" ;SearchString="Cumulative Update for Microsoft server operating system version 22H2 for x64-based Systems" ;SSUSearchString=$null ; ID="Microsoft Server operating system-22H2"}
44+
$Products+=@{Product="Azure Stack HCI 21H2 and Windows Server 2022" ;SearchString="Cumulative Update for Microsoft server operating system version 21H2 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Microsoft server operating system version 21H2 for x64-based Systems" ; ID="Microsoft Server operating system-21H2"}
45+
$Products+=@{Product="Azure Stack HCI 20H2" ;SearchString="Cumulative Update for Azure Stack HCI, version 20H2" ;SSUSearchString="Servicing Stack Update for Azure Stack HCI, version 20H2 for x64-based Systems" ; ID="Azure Stack HCI"} #unsupported release SSU no longer required but remain for compat reasons
46+
$Products+=@{Product="Windows Server 2019" ;SearchString="Cumulative Update for Windows Server 2019 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows Server 2019 for x64-based Systems" ; ID="Windows Server 2019"} #SSU no longer required but remain for compat reasons
47+
$Products+=@{Product="Windows Server 2016" ;SearchString="Cumulative Update for Windows Server 2016 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows Server 2016 for x64-based Systems" ; ID="Windows Server 2016"} #SSU no longer required but remain for compat reasons
48+
$Products+=@{Product="Windows 11 23H2" ;SearchString="Cumulative Update for Windows 11 Version 23H2 for x64-based Systems" ;SSUSearchString=$null ; ID="Windows 11"}
49+
$Products+=@{Product="Windows 11 22H2" ;SearchString="Cumulative Update for Windows 11 Version 22H2 for x64-based Systems" ;SSUSearchString=$null ; ID="Windows 11"}
50+
$Products+=@{Product="Windows 10 21H2" ;SearchString="Cumulative Update for Windows 10 Version 21H2 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows 10 Version 21H2 for x64-based Systems" ; ID="Windows 10, version 1903 and later, Windows 10 LTSB"} #SSU no longer required but remain for compat reasons
51+
$Products+=@{Product="Windows 10 20H2" ;SearchString="Cumulative Update for Windows 10 Version 20H2 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows 10 Version 20H2 for x64-based Systems" ; ID="Windows 10, version 1903 and later"} #SSU no longer required but remain for compat reasons
52+
$Products+=@{Product="Windows 10 2004" ;SearchString="Cumulative Update for Windows 10 Version 2004 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows 10 Version 2004 for x64-based Systems" ; ID="Windows 10, version 1903 and later"} #SSU no longer required but remain for compat reasons
53+
$Products+=@{Product="Windows 10 1909" ;SearchString="Cumulative Update for Windows 10 Version 1909 for x64-based Systems" ;SSUSearchString="Servicing Stack Update for Windows 10 Version 1909 for x64-based Systems" ; ID="Windows 10, version 1903 and later"} #SSU no longer required but remain for compat reasons
5254

5355
#grab folder to download to
5456
$folder=Read-Host -Prompt "Please type path to download. For example `"c:\temp`" (if nothing specified, $PSScriptRoot is used)"
@@ -80,13 +82,18 @@ Foreach($SelectedProduct in $SelectedProducts){
8082
$update | Save-MSCatalogUpdate -Destination "$DestinationFolder" #-UseBits
8183

8284
#Download SSU
83-
$update=Get-MSCatalogUpdate -Search $item.SSUSearchString | Where-Object Products -eq $item.ID | Select-Object -First 1
84-
if ($update){
85-
Write-Output "Downloading $($update.title) to $destinationFolder"
86-
$update | Save-MSCatalogUpdate -Destination $DestinationFolder #-UseBits
87-
}
85+
If (!($Null -eq $item.SSUSearchString)){
86+
$update=Get-MSCatalogUpdate -Search $item.SSUSearchString | Where-Object Products -eq $item.ID | Select-Object -First 1
87+
if ($update){
88+
Write-Output "Downloading $($update.title) to $destinationFolder"
89+
$update | Save-MSCatalogUpdate -Destination $DestinationFolder #-UseBits
90+
}
91+
}#end if check if SSUString is not $Null
92+
else{
93+
Write-Host "The selected release does not require seperate SSU." -ForegroundColor Green
94+
}#end elseif check if SSUString is $Null
8895
}
8996
#endregion
9097

9198
Write-Host "Job finished. Press enter to continue" -ForegroundColor Green
92-
Read-Host
99+
Read-Host

0 commit comments

Comments
 (0)