Skip to content

Commit

Permalink
Merge pull request #448 from microsoft/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Jaromir Kaspar authored Jul 11, 2021
2 parents fbc4846 + 7e6e033 commit 8f0fb84
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 35 deletions.
5 changes: 5 additions & 0 deletions Scenarios/AzSHCI Deployment/LabConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@ $LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!' ; <#Prefix =
#Or with nested virtualization enabled
#1..4 | ForEach-Object {$LABConfig.VMs += @{ VMName = "AzSHCI$_" ; Configuration = 'S2D' ; ParentVHD = 'AzSHCI20H2_G2.vhdx' ; HDDNumber = 10 ; HDDSize= 10TB ; MemoryStartupBytes= 4GB; VMProcessorCount="Max" ; NestedVirt=$true}}

#or Azure Stack HCI 21H2
1..4 | ForEach-Object {$LABConfig.VMs += @{ VMName = "AzSHCI$_" ; Configuration = 'S2D' ; ParentVHD = 'AzSHCI21H2_G2.vhdx' ; HDDNumber = 10 ; HDDSize= 10TB ; MemoryStartupBytes= 1GB; VMProcessorCount="Max" ; vTPM=$true}}
#Or with nested virtualization enabled
#1..4 | ForEach-Object {$LABConfig.VMs += @{ VMName = "AzSHCI$_" ; Configuration = 'S2D' ; ParentVHD = 'AzSHCI21H2_G2.vhdx' ; HDDNumber = 10 ; HDDSize= 10TB ; MemoryStartupBytes= 4GB; VMProcessorCount="Max" ; vTPM=$true ; NestedVirt=$true}}

#Optional Windows Admin Center in GW mode
$LabConfig.VMs += @{ VMName = 'WACGW' ; ParentVHD = 'Win2019Core_G2.vhdx'; MGMTNICs=1}
64 changes: 32 additions & 32 deletions Scenarios/AzSHCI Deployment/Scenario.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -798,38 +798,6 @@
start-sleep 10
#endregion

#region Create some VMs (3 per each CSV disk) https://github.com/Microsoft/WSLab/tree/master/Scenarios/S2D%20and%20Bulk%20VM%20creation
Start-Sleep -Seconds 60 #just to a bit wait as I saw sometimes that first VMs fails to create
if ($realVMs -and $VHDPath){
$CSVs=(Get-ClusterSharedVolume -Cluster $ClusterName).Name
foreach ($CSV in $CSVs){
$CSV=($CSV -split '\((.*?)\)')[1]
1..$NumberOfRealVMs | ForEach-Object {
$VMName="TestVM$($CSV)_$_"
New-Item -Path "\\$ClusterName\ClusterStorage$\$CSV\$VMName\Virtual Hard Disks" -ItemType Directory
Copy-Item -Path $VHDPath -Destination "\\$ClusterName\ClusterStorage$\$CSV\$VMName\Virtual Hard Disks\$VMName.vhdx"
New-VM -Name $VMName -MemoryStartupBytes 512MB -Generation 2 -Path "c:\ClusterStorage\$CSV\" -VHDPath "c:\ClusterStorage\$CSV\$VMName\Virtual Hard Disks\$VMName.vhdx" -CimSession ((Get-ClusterNode -Cluster $ClusterName).Name | Get-Random)
Add-ClusterVirtualMachineRole -VMName $VMName -Cluster $ClusterName
}
}
#Start all VMs
Start-VM -VMname * -CimSession (Get-ClusterNode -Cluster $clustername).Name
}else{
$CSVs=(Get-ClusterSharedVolume -Cluster $ClusterName).Name
foreach ($CSV in $CSVs){
$CSV=($CSV -split '\((.*?)\)')[1]
1..3 | ForEach-Object {
$VMName="TestVM$($CSV)_$_"
Invoke-Command -ComputerName ((Get-ClusterNode -Cluster $ClusterName).Name | Get-Random) -ArgumentList $CSV,$VMName -ScriptBlock {
#create some fake VMs
New-VM -Name $using:VMName -NewVHDPath "c:\ClusterStorage\$($using:CSV)\$($using:VMName)\Virtual Hard Disks\$($using:VMName).vhdx" -NewVHDSizeBytes 32GB -SwitchName $using:vSwitchName -Generation 2 -Path "c:\ClusterStorage\$($using:CSV)\" -MemoryStartupBytes 32MB
}
Add-ClusterVirtualMachineRole -VMName $VMName -Cluster $ClusterName
}
}
}
#endregion

#region Register Azure Stack HCI to Azure
#download Azure module
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Expand Down Expand Up @@ -898,6 +866,38 @@
#>
#endregion

#region Create some VMs (3 per each CSV disk) https://github.com/Microsoft/WSLab/tree/master/Scenarios/S2D%20and%20Bulk%20VM%20creation
Start-Sleep -Seconds 60 #just to a bit wait as I saw sometimes that first VMs fails to create
if ($realVMs -and $VHDPath){
$CSVs=(Get-ClusterSharedVolume -Cluster $ClusterName).Name
foreach ($CSV in $CSVs){
$CSV=($CSV -split '\((.*?)\)')[1]
1..$NumberOfRealVMs | ForEach-Object {
$VMName="TestVM$($CSV)_$_"
New-Item -Path "\\$ClusterName\ClusterStorage$\$CSV\$VMName\Virtual Hard Disks" -ItemType Directory
Copy-Item -Path $VHDPath -Destination "\\$ClusterName\ClusterStorage$\$CSV\$VMName\Virtual Hard Disks\$VMName.vhdx"
New-VM -Name $VMName -MemoryStartupBytes 512MB -Generation 2 -Path "c:\ClusterStorage\$CSV\" -VHDPath "c:\ClusterStorage\$CSV\$VMName\Virtual Hard Disks\$VMName.vhdx" -CimSession ((Get-ClusterNode -Cluster $ClusterName).Name | Get-Random)
Add-ClusterVirtualMachineRole -VMName $VMName -Cluster $ClusterName
}
}
#Start all VMs
Start-VM -VMname * -CimSession (Get-ClusterNode -Cluster $clustername).Name
}else{
$CSVs=(Get-ClusterSharedVolume -Cluster $ClusterName).Name
foreach ($CSV in $CSVs){
$CSV=($CSV -split '\((.*?)\)')[1]
1..3 | ForEach-Object {
$VMName="TestVM$($CSV)_$_"
Invoke-Command -ComputerName ((Get-ClusterNode -Cluster $ClusterName).Name | Get-Random) -ArgumentList $CSV,$VMName -ScriptBlock {
#create some fake VMs
New-VM -Name $using:VMName -NewVHDPath "c:\ClusterStorage\$($using:CSV)\$($using:VMName)\Virtual Hard Disks\$($using:VMName).vhdx" -NewVHDSizeBytes 32GB -SwitchName $using:vSwitchName -Generation 2 -Path "c:\ClusterStorage\$($using:CSV)\" -MemoryStartupBytes 32MB
}
Add-ClusterVirtualMachineRole -VMName $VMName -Cluster $ClusterName
}
}
}
#endregion

#region (optional) Install Windows Admin Center Gateway https://github.com/microsoft/WSLab/tree/master/Scenarios/Windows%20Admin%20Center%20and%20Enterprise%20CA#gw-mode-installation-with-self-signed-cert
##Install Windows Admin Center Gateway
$GatewayServerName="WACGW"
Expand Down
4 changes: 2 additions & 2 deletions Scripts/LabConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ $LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!'; Prefix = 'M
1..4 | ForEach-Object {$VMNames="S2D"; $LABConfig.VMs += @{ VMName = "$VMNames$_" ; Configuration = 'S2D' ; ParentVHD = 'Win2019Core_G2.vhdx'; SSDNumber = 0; SSDSize=800GB ; HDDNumber = 12; HDDSize= 4TB ; MemoryStartupBytes= 512MB }}
# Or Azure Stack HCI
#1..4 | ForEach-Object {$VMNames="AzSHCI"; $LABConfig.VMs += @{ VMName = "$VMNames$_" ; Configuration = 'S2D' ; ParentVHD = 'AzSHCI20H2_G2.vhdx'; SSDNumber = 0; SSDSize=800GB ; HDDNumber = 12; HDDSize= 4TB ; MemoryStartupBytes= 1GB }}
# Or Windows Server Insider Preview
#1..4 | ForEach-Object {$VMNames="S2D"; $LABConfig.VMs += @{ VMName = "$VMNames$_" ; Configuration = 'S2D' ; ParentVHD = 'WinSrvInsiderCore_20282.vhdx'; SSDNumber = 0; SSDSize=800GB ; HDDNumber = 12; HDDSize= 4TB ; MemoryStartupBytes= 512MB }}
# Or Windows Server 2022
#1..4 | ForEach-Object {$VMNames="S2D"; $LABConfig.VMs += @{ VMName = "$VMNames$_" ; Configuration = 'S2D' ; ParentVHD = 'Win2022Core_G2.vhdx'; SSDNumber = 0; SSDSize=800GB ; HDDNumber = 12; HDDSize= 4TB ; MemoryStartupBytes= 512MB }}


### HELP ###
Expand Down
8 changes: 7 additions & 1 deletion Tools/CreateParentDisk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ If (-not $isAdmin) {
$tempvhdname = switch ($BuildNumber){
17784 {
"AzSHCI20H2_G2.vhdx"
}
20348 {
"AzSHCI21H2_G2.vhdx"
}
}
}elseif (($Edition -like "*Server*Core*") -or ($Edition -like "Windows Server * Datacenter") -or ($Edition -like "Windows Server * Standard")){
Expand Down Expand Up @@ -287,8 +290,11 @@ If (-not $isAdmin) {
19041 {
"Win1020H1_G2.vhdx"
}
22000 {
"Win1121H2_G2.vhdx"
}
}
if ($BuildNumber -GT 19041){
if ($BuildNumber -GT 22000){
$tempvhdname="Win10Insider_$BuildNumber.vhdx"
}
}
Expand Down

0 comments on commit 8f0fb84

Please sign in to comment.