Skip to content

Commit

Permalink
Merge pull request #508 from microsoft/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jaromirk authored May 18, 2022
2 parents c50c830 + a8fa66a commit 49b4c79
Show file tree
Hide file tree
Showing 12 changed files with 951 additions and 22 deletions.
36 changes: 34 additions & 2 deletions Scenarios/AzSHCI Deployment/Scenario.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@
$OSInfo=Invoke-Command -ComputerName $ClusterName -ScriptBlock {
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\'
}
if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuildNumber -ge 20348){
if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuild -ge 20348){
Get-StoragePool -CimSession $ClusterName -FriendlyName S2D* | Set-StoragePool -ProvisioningTypeDefault Thin
}
#endregion
Expand Down Expand Up @@ -1116,7 +1116,39 @@
Set-ADComputer -Identity $computerObject -PrincipalsAllowedToDelegateToAccount $gatewayObject
}

#Install Edge
#update installed extensions
#https://docs.microsoft.com/en-us/windows-server/manage/windows-admin-center/configure/use-powershell
#Copy Posh Modules from wacgw
$Session=New-PSSession -ComputerName $GatewayServerName
Copy-Item -Path "C:\Program Files\Windows Admin Center\PowerShell\" -Destination "C:\Program Files\Windows Admin Center\PowerShell\" -Recurse -FromSession $Session
$Session | Remove-PSSession

#Import Posh Modules
$Items=Get-ChildItem -Path "C:\Program Files\Windows Admin Center\PowerShell\Modules" -Recurse | Where-Object Extension -eq ".psm1"
foreach ($Item in $Items){
Import-Module $Item.fullName
}

#list commands
Get-Command -Module ExtensionTools

#grab installed extensions
$InstalledExtensions=Get-Extension -GatewayEndpoint https://$GatewayServerName | Where-Object status -eq Installed
$ExtensionsToUpdate=$InstalledExtensions | Where-Object IsLatestVersion -eq $False

foreach ($Extension in $ExtensionsToUpdate){
Update-Extension -GatewayEndpoint https://$GatewayServerName -ExtensionId $Extension.ID
}

#Install OpenManage extension and increase MaxEvenlope size
if ($DellHW){
Install-Extension -GatewayEndpoint https://$GatewayServerName -ExtensionId dell-emc.openmanage-integration
Invoke-Command -ComputerName $Servers -ScriptBlock {
Set-Item -Path WSMan:\localhost\MaxEnvelopeSizekb -Value 4096
}
}

#Install Edge if not available on system
if (-not (test-path "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe")){
Start-BitsTransfer -Source "https://aka.ms/edge-msi" -Destination "$env:USERPROFILE\Downloads\MicrosoftEdgeEnterpriseX64.msi"
#start install
Expand Down
8 changes: 4 additions & 4 deletions Scenarios/AzSHCI and AVD/Scenario.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
$OSInfo=Invoke-Command -ComputerName $ClusterName -ScriptBlock {
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\'
}
if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuildNumber -ge 20348){
if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuild -ge 20348){
Get-StoragePool -CimSession $ClusterName -FriendlyName S2D* | Set-StoragePool -ProvisioningTypeDefault Thin
}

Expand Down Expand Up @@ -1284,10 +1284,10 @@
#region setup FSLogix (based on https://github.com/microsoft/MSLab/blob/master/Scenarios/FSLogix/Scenario.ps1)
#Grab VHD for FileServer VM and copy it to new library volume
#Ask for VHD
Write-Output "Please select VHD With Windows Server"
Write-Output "Please select VHD with Windows Server"
[reflection.assembly]::loadwithpartialname("System.Windows.Forms")
$openFile = New-Object System.Windows.Forms.OpenFileDialog -Property @{
Title="Please select VHD created using CreateVMFleetDisk.ps1"
Title="Please select VHD with Windows Server created using CreateParentDisk.ps1"
}
$openFile.Filter = "vhdx files (*.vhdx)|*.vhdx|All files (*.*)|*.*"
If($openFile.ShowDialog() -eq "OK"){
Expand Down Expand Up @@ -1481,7 +1481,7 @@
$accounts+="corp\Domain Users"
New-SmbShare -Name $FolderName -Path "D:\Shares\$FolderName" -ReadAccess $accounts -CimSession $FileServerName
#Set NTFS permissions
Invoke-Command -ComputerName $$FileServerName -ScriptBlock {(Get-SmbShare $using:FolderName).PresetPathAcl | Set-Acl}
Invoke-Command -ComputerName $FileServerName -ScriptBlock {(Get-SmbShare $using:FolderName).PresetPathAcl | Set-Acl}

#Download MSIX Package
if (!(Test-Path "$env:USERPROFILE\Downloads\msixmgr\x64\msixmgr.exe")){
Expand Down
12 changes: 6 additions & 6 deletions Scenarios/AzSHCI and Arc-enabled VMs/Scenario.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
$OSInfo=Invoke-Command -ComputerName $ClusterName -ScriptBlock {
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\'
}
if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuildNumber -ge 20348){
if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuild -ge 20348){
Get-StoragePool -CimSession $ClusterName -FriendlyName S2D* | Set-StoragePool -ProvisioningTypeDefault Thin
}

Expand Down Expand Up @@ -327,14 +327,14 @@

#deploy control plane and export kube config
az arcappliance deploy hci --config-file \\$ClusterName\ClusterStorage$\$VolumeName\workingDir\hci-appliance.yaml --outfile $env:USERPROFILE\.kube\config
#create connection to Azure (will throw error, dont worry! It's being deployed on background)
#create connection to Azure (might throw error, dont worry! It's being deployed on background)
az arcappliance create hci --config-file \\$ClusterName\ClusterStorage$\$VolumeName\workingDir\hci-appliance.yaml --kubeconfig $env:USERPROFILE\.kube\config

#wait until appliance is running
#wait until appliance is running
do {
$Status=az arcappliance show --resource-group $HCIResourceGroupName --name $BridgeResourceName | ConvertFrom-Json
Write-Output "Waiting for Appliance to be running"
Start-Sleep 5
$Status=az arcappliance show --only-show-errors --resource-group $HCIResourceGroupName --name $BridgeResourceName | ConvertFrom-Json
Write-Host -NoNewline -Object "."
Start-Sleep 2
} until ($status.status -match "Running")

#verify if appliance is running
Expand Down
4 changes: 2 additions & 2 deletions Scenarios/AzSHCI and Azure Benefits/Scenario.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ $VMs+=@{VMName="WS2022AzCore02" ; MemoryStartupBytes=1GB ; DynamicMemory=$true
}
$OSInfo | Select-Object PSComputerName,CurrentBuildNumber,DisplayVersion,UBR

if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuildNumber -ge 20348){
if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuild -ge 20348){
Get-StoragePool -CimSession $ClusterName -FriendlyName S2D* | Set-StoragePool -ProvisioningTypeDefault Thin
}
#All nodes has to be at least 12b update (UBR 405 on 21H2)
Expand Down Expand Up @@ -232,7 +232,7 @@ $VMs+=@{VMName="WS2022AzCore02" ; MemoryStartupBytes=1GB ; DynamicMemory=$true
$OSInfo=Invoke-Command -ComputerName $ClusterName -ScriptBlock {
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\'
}
if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuildNumber -ge 20348){
if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuild -ge 20348){
Get-StoragePool -CimSession $ClusterName -FriendlyName S2D* | Set-StoragePool -ProvisioningTypeDefault Thin
}
#validate pool setting
Expand Down
5 changes: 4 additions & 1 deletion Scenarios/AzSHCI and Dell Servers Update/Scenario.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@

#upload DSU to servers
$Sessions=New-PSSession -ComputerName $Nodes
Invoke-Command -Session $Sessions -ScriptBlock {
if (-not (Test-Path $using:DSUDownloadFolder -ErrorAction Ignore)){New-Item -Path $using:DSUDownloadFolder -ItemType Directory}
}
foreach ($Session in $Sessions){
Copy-Item -Path $DSUDownloadFolder -Destination $DSUDownloadFolder -ToSession $Session -Recurse -Force
Copy-Item -Path "$DSUDownloadFolder\DSU.exe" -Destination "$DSUDownloadFolder" -ToSession $Session -Force -Recurse
}
$Sessions | Remove-PSSession
#install DSU
Expand Down
2 changes: 1 addition & 1 deletion Scenarios/AzSHCI and Kubernetes/Scenario.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Foreach ($PSSession in $PSSessions){
$OSInfo=Invoke-Command -ComputerName $ClusterName -ScriptBlock {
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\'
}
if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuildNumber -ge 20348){
if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuild -ge 20348){
Get-StoragePool -CimSession $ClusterName -FriendlyName S2D* | Set-StoragePool -ProvisioningTypeDefault Thin
}

Expand Down
2 changes: 1 addition & 1 deletion Scenarios/AzSHCI and MDT/Scenario.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
}

#Import Operating System
$ISO = Mount-DiskImage -ImagePath "$downloadfolder\AzureStackHCI_20348.288_en-us.iso" -PassThru
$ISO = Mount-DiskImage -ImagePath "$downloadfolder\AzureStackHCI_20348.587_en-us.iso" -PassThru
$ISOMediaPath = (Get-Volume -DiskImage $ISO).DriveLetter+':\'
Import-mdtoperatingsystem -path "DS001:\Operating Systems" -SourcePath $ISOMediaPath -DestinationFolder "Azure Stack HCI SERVERAZURESTACKHCICORE x64" -Verbose

Expand Down
14 changes: 14 additions & 0 deletions Scenarios/AzSHCI and SCVMM 2022/LabConfig.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

$LabConfig=@{DomainAdminName='LabAdmin'; AdminPassword='LS1setup!' ; <#Prefix = 'MSLab-'#> ; DCEdition='4'; Internet=$true ; <#UseHostDnsAsForwarder=$True ;#> InstallSCVMM="yes"; AdditionalNetworksConfig=@(); VMs=@()}

#just 2 nodes with nested virtualization enabled
1..2 | ForEach-Object {$LABConfig.VMs += @{ VMName = "AzSVMM$_" ; Configuration = 'S2D' ; ParentVHD = 'AzSHCI21H2_G2.vhdx' ; HDDNumber = 10 ; HDDSize= 10TB ; MemoryStartupBytes= 8GB; VMProcessorCount="Max" ; vTPM=$true ; NestedVirt=$true}}

#or small just when host is limited
#1..2 | ForEach-Object {$LABConfig.VMs += @{ VMName = "AzSHCI$_" ; Configuration = 'S2D' ; ParentVHD = 'AzSHCI21H2_G2.vhdx' ; HDDNumber = 10 ; HDDSize= 10TB ; MemoryStartupBytes= 1GB; VMProcessorCount="Max" ; vTPM=$true}}

#File share for images for SCVMM Library
$LabConfig.VMs += @{ VMName = 'Library' ; Configuration = 'S2D' ; ParentVHD = 'Win2022Core_G2.vhdx' ; SSDNumber = 1; SSDSize=1TB ; MGMTNICs=1 }

#Windows Server Update Services
$LabConfig.VMs += @{ VMName = 'WSUS' ; ParentVHD = 'Win2022Core_G2.vhdx'; MGMTNICs=1}
Loading

0 comments on commit 49b4c79

Please sign in to comment.