Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

master -> dev #584

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 35 additions & 17 deletions Scenarios/AzSHCI and Cloud Based Deployment/Scenario.ps1
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
#region Prepare Active Directory
$AsHCIOUName="OU=ASClus01,DC=Corp,DC=contoso,DC=com"
$Servers="ASNode1","ASNode2"
$DomainFQDN=$env:USERDNSDOMAIN
$ClusterName="ASClus01"
$Prefix="ASClus01"
$UserName="ASClus01-DeployUser"
$Password="LS1setup!LS1setup!"
$SecuredPassword = ConvertTo-SecureString $password -AsPlainText -Force
$Credentials= New-Object System.Management.Automation.PSCredential ($UserName,$SecuredPassword)
#$Servers="ASNode1","ASNode2"
#$DomainFQDN=$env:USERDNSDOMAIN
#$ClusterName="ASClus01"
#$Prefix="ASClus01"
$LCMUserName="ASClus01-LCMUser"
$LCMPassword="LS1setup!LS1setup!"
$SecuredPassword = ConvertTo-SecureString $LCMPassword -AsPlainText -Force
$LCMCredentials= New-Object System.Management.Automation.PSCredential ($LCMUserName,$SecuredPassword)

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

#add KDS Root Key
if (-not (Get-KdsRootKey)){
Add-KdsRootKey -EffectiveTime ((Get-Date).addhours(-10))
}

#make sure active directory module and GPMC is installed
Install-WindowsFeature -Name RSAT-AD-PowerShell,GPMC

#populate objects
New-HciAdObjectsPreCreation -Deploy -AzureStackLCMUserCredential $Credentials -AsHciOUName $AsHCIOUName -AsHciPhysicalNodeList $Servers -DomainFQDN $DomainFQDN -AsHciClusterName $ClusterName -AsHciDeploymentPrefix $Prefix

New-HciAdObjectsPreCreation -AzureStackLCMUserCredential $LCMCredentials -AsHciOUName $AsHCIOUName
#install management features to explore cluster,settings...
Install-WindowsFeature -Name "RSAT-ADDS","RSAT-Clustering"
#endregion
Expand Down Expand Up @@ -140,7 +135,7 @@
"Microsoft.ExtendedLocation/register/action",
"Microsoft.HybridContainerService/register/action",
"Microsoft.ResourceConnector/appliances/write",
"Microsoft.ResourceConnector/appliances/delete,
"Microsoft.ResourceConnector/appliances/delete",
"Microsoft.ResourceConnector/appliances/listClusterUserCredential/action",
"Microsoft.ResourceConnector/appliances/read",
"Microsoft.ExtendedLocation/customLocations/read",
Expand Down Expand Up @@ -284,6 +279,13 @@
Install-Module -Name az.accounts -Force
} -Credential $Credentials

#make sure resource providers are registered
Register-AzResourceProvider -ProviderNamespace "Microsoft.HybridCompute"
Register-AzResourceProvider -ProviderNamespace "Microsoft.GuestConfiguration"
Register-AzResourceProvider -ProviderNamespace "Microsoft.HybridConnectivity"
Register-AzResourceProvider -ProviderNamespace "Microsoft.AzureStackHCI"


#deploy ARC Agent with device authentication
$ARMtoken = (Get-AzAccessToken).Token
$id = (Get-AzContext).Account.Id
Expand Down Expand Up @@ -390,7 +392,7 @@
}
Write-Host "." -NoNewline
} until (
$status.provisioningstate -notcontains "Creatingg"
$status.provisioningstate -notcontains "Creating"
)

#Assign role to ARC Objects
Expand Down Expand Up @@ -432,6 +434,22 @@
#endregion

#region final touches
#make sure NTP server is configured
#note make sure integration service is disabled on host if running in VMs
#Get-VM *ASNode* | Disable-VMIntegrationService -Name "Time Synchronization"

$NTPServer="DC.corp.contoso.com"
Invoke-Command -ComputerName $servers -ScriptBlock {
w32tm /config /manualpeerlist:$using:NTPServer /syncfromflags:manual /update
Restart-Service w32time
} -Credential $Credentials

Start-Sleep 20

#check if source is NTP Server
Invoke-Command -ComputerName $servers -ScriptBlock {
w32tm /query /source
} -Credential $Credentials

#make sure there is only one management NIC with IP address (setup is complaining about multiple gateways)
Invoke-Command -ComputerName $servers -ScriptBlock {
Expand Down
2 changes: 1 addition & 1 deletion Scripts/0_Shared.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ function Send-TelemetryEvent {
}
}

function Send-TelemetryEvent {
function Send-TelemetryEvents {
param(
[Parameter(Mandatory = $true)]
[array]$Events
Expand Down
39 changes: 23 additions & 16 deletions Tools/DownloadLatestCUs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ if ($version.Minor -eq 27){
}

$Products=@()
$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"}
$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"}
$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"}
$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"}
$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"}
$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"}
$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"}
$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"}
$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"}
$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"}
$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
$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"}
$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"}
$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
$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
$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
$Products+=@{Product="Windows 11 23H2" ;SearchString="Cumulative Update for Windows 11 Version 23H2 for x64-based Systems" ;SSUSearchString=$null ; ID="Windows 11"}
$Products+=@{Product="Windows 11 22H2" ;SearchString="Cumulative Update for Windows 11 Version 22H2 for x64-based Systems" ;SSUSearchString=$null ; ID="Windows 11"}
$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
$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
$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
$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

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

#Download SSU
$update=Get-MSCatalogUpdate -Search $item.SSUSearchString | Where-Object Products -eq $item.ID | Select-Object -First 1
if ($update){
Write-Output "Downloading $($update.title) to $destinationFolder"
$update | Save-MSCatalogUpdate -Destination $DestinationFolder #-UseBits
}
If (!($Null -eq $item.SSUSearchString)){
$update=Get-MSCatalogUpdate -Search $item.SSUSearchString | Where-Object Products -eq $item.ID | Select-Object -First 1
if ($update){
Write-Output "Downloading $($update.title) to $destinationFolder"
$update | Save-MSCatalogUpdate -Destination $DestinationFolder #-UseBits
}
}#end if check if SSUString is not $Null
else{
Write-Host "The selected release does not require seperate SSU." -ForegroundColor Green
}#end elseif check if SSUString is $Null
}
#endregion

Write-Host "Job finished. Press enter to continue" -ForegroundColor Green
Read-Host
Read-Host
Loading