Skip to content

Commit

Permalink
Merge pull request #432 from microsoft/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Jaromir Kaspar authored Feb 25, 2021
2 parents 736919f + 119ba60 commit 3ec7219
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 27 deletions.
12 changes: 6 additions & 6 deletions Scripts/1_Prereq.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function Get-WindowsBuildNumber {
Start-Transcript -Path "$PSScriptRoot\Prereq.log"
$StartDateTime = Get-Date
WriteInfo "Script started at $StartDateTime"
WriteInfo "`nWSLab Version $wslabVersion"
WriteInfo "`nMSLab Version $mslabVersion"

#Load LabConfig....
. "$PSScriptRoot\LabConfig.ps1"
Expand Down Expand Up @@ -59,7 +59,7 @@ function Get-WindowsBuildNumber {

# Check if not running in root folder
if (($psscriptroot).Length -eq 3) {
WriteErrorAndExit "`t WSLab canot run in root folder. Please put WSLab scripts into a folder. Exiting"
WriteErrorAndExit "`t MSLab canot run in root folder. Please put MSLab scripts into a folder. Exiting"
}

# Checking for Compatible OS
Expand Down Expand Up @@ -90,7 +90,7 @@ function Get-WindowsBuildNumber {
WriteSuccess "`t $Filename is present, skipping download"
}else{
$FileContent=$null
$FileContent = (Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/Microsoft/WSLab/master/Tools/$Filename.ps1").Content
$FileContent = (Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/Microsoft/MSLab/master/Tools/$Filename.ps1").Content
if ($FileContent){
$script = New-Item $Path -type File -Force
$FileContent=$FileContent -replace "PasswordGoesHere",$LabConfig.AdminPassword #only applies to 1_SQL_Install and 3_SCVMM_Install.ps1
Expand All @@ -109,7 +109,7 @@ function Get-WindowsBuildNumber {
WriteSuccess "`t $Filename is present, skipping download"
}else{
$FileContent = $null
$FileContent = (Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/Microsoft/WSLab/master/Tools/$Filename.ps1").Content
$FileContent = (Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/Microsoft/MSLab/master/Tools/$Filename.ps1").Content
if ($FileContent){
$script = New-Item $Path -type File -Force
$FileContent=$FileContent -replace "PasswordGoesHere",$LabConfig.AdminPassword
Expand All @@ -128,7 +128,7 @@ function Get-WindowsBuildNumber {
WriteSuccess "`t $Filename is present, skipping download"
}else{
$FileContent = $null
$FileContent = (Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/Microsoft/WSLab/master/Tools/$FileName.ps1").Content
$FileContent = (Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/Microsoft/MSLab/master/Tools/$FileName.ps1").Content
if ($FileContent){
$script = New-Item "$PSScriptRoot\ParentDisks\$FileName.ps1" -type File -Force
Set-Content -path $script -value $FileContent
Expand All @@ -145,7 +145,7 @@ If ( Test-Path -Path "$PSScriptRoot\Temp\Convert-WindowsImage.ps1" ) {
}else{
WriteInfo "`t Downloading Convert-WindowsImage"
try {
Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/microsoft/WSLab/master/Tools/Convert-WindowsImage.ps1" -OutFile "$PSScriptRoot\Temp\Convert-WindowsImage.ps1"
Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/microsoft/MSLab/master/Tools/Convert-WindowsImage.ps1" -OutFile "$PSScriptRoot\Temp\Convert-WindowsImage.ps1"
} catch {
WriteError "`t Failed to download Convert-WindowsImage.ps1!"
}
Expand Down
12 changes: 6 additions & 6 deletions Scripts/2_CreateParentDisks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ If (-not $isAdmin) {
Start-Transcript -Path "$PSScriptRoot\CreateParentDisks.log"
$StartDateTime = Get-Date
WriteInfo "Script started at $StartDateTime"
WriteInfo "`nWSLab Version $wslabVersion"
WriteInfo "`nMSLab Version $mslabVersion"

#Load LabConfig....
. "$PSScriptRoot\LabConfig.ps1"
Expand Down Expand Up @@ -166,7 +166,7 @@ If (-not $isAdmin) {

#Check if not running in root folder
if (($PSScriptRoot).Length -eq 3) {
WriteErrorAndExit "`t WSLab canot run in root folder. Please put WSLab scripts into a folder. Exiting"
WriteErrorAndExit "`t MSLab canot run in root folder. Please put MSLab scripts into a folder. Exiting"
}

#check Hyper-V
Expand Down Expand Up @@ -245,8 +245,8 @@ If (-not $isAdmin) {
WriteInfoHighlighted "Checking if volume filesystem is NTFS or ReFS"
$driveletter=$PSScriptRoot -split ":" | Select-Object -First 1
if ($PSScriptRoot -like "c:\ClusterStorage*"){
WriteSuccess "`t Volume Cluster Shared Volume. Mountdir will be $env:Temp\WSLAbMountdir"
$mountdir="$env:Temp\WSLAbMountdir"
WriteSuccess "`t Volume Cluster Shared Volume. Mountdir will be $env:Temp\MSLabMountdir"
$mountdir="$env:Temp\MSLabMountdir"
$VolumeFileSystem="CSVFS"
}else{
$mountdir="$PSScriptRoot\Temp\MountDir"
Expand Down Expand Up @@ -595,8 +595,8 @@ If (-not $isAdmin) {
if ($VMVersion.Build -ge 17763){
$oeminformation=@"
<OEMInformation>
<SupportProvider>WSLab</SupportProvider>
<SupportURL>https://aka.ms/wslab</SupportURL>
<SupportProvider>MSLab</SupportProvider>
<SupportURL>https://aka.ms/mslab</SupportURL>
</OEMInformation>
"@
}else{
Expand Down
12 changes: 6 additions & 6 deletions Scripts/3_Deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,8 @@ If (-not $isAdmin) {
if ($VMVersion.Build -ge 17763){
$oeminformation=@"
<OEMInformation>
<SupportProvider>WSLab</SupportProvider>
<SupportURL>https://aka.ms/wslab</SupportURL>
<SupportProvider>MSLab</SupportProvider>
<SupportURL>https://aka.ms/mslab</SupportURL>
</OEMInformation>
"@
}else{
Expand Down Expand Up @@ -674,7 +674,7 @@ If (-not $isAdmin) {

$StartDateTime = Get-Date
WriteInfoHighlighted "Script started at $StartDateTime"
WriteInfo "`nWSLab Version $wslabVersion"
WriteInfo "`nMSLab Version $mslabVersion"


##Load LabConfig....
Expand Down Expand Up @@ -765,7 +765,7 @@ If (-not $isAdmin) {

# Checking if not running in root folder
if (($PSScriptRoot).Length -eq 3) {
WriteErrorAndExit "`t WSLab canot run in root folder. Please put WSLab scripts into a folder. Exiting"
WriteErrorAndExit "`t MSLab canot run in root folder. Please put MSLab scripts into a folder. Exiting"
}

# Checking for Compatible OS
Expand Down Expand Up @@ -872,8 +872,8 @@ If (-not $isAdmin) {
WriteInfoHighlighted "Checking if volume filesystem is NTFS or ReFS"
$driveletter=$PSScriptRoot -split ":" | Select-Object -First 1
if ($PSScriptRoot -like "c:\ClusterStorage*"){
WriteSuccess "`t Volume Cluster Shared Volume. Mountdir will be $env:Temp\WSLAbMountdir"
$mountdir="$env:Temp\WSLAbMountDir"
WriteSuccess "`t Volume Cluster Shared Volume. Mountdir will be $env:Temp\MSLabMountdir"
$mountdir="$env:Temp\MSLabMountDir"
$VolumeFileSystem="CSVFS"
}else{
$mountdir="$PSScriptRoot\Temp\MountDir"
Expand Down
14 changes: 7 additions & 7 deletions Scripts/LabConfig.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#basic config for Windows Server 2019, that creates VMs for S2D Hyperconverged scenario https://github.com/Microsoft/WSLab/tree/master/Scenarios/S2D%20Hyperconverged
#basic config for Windows Server 2019, that creates VMs for S2D Hyperconverged scenario https://github.com/Microsoft/MSLab/tree/master/Scenarios/S2D%20Hyperconverged

$LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!'; Prefix = 'WSLab-' ; DCEdition='4'; Internet=$true ; AdditionalNetworksConfig=@(); VMs=@()}
$LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!'; Prefix = 'MSLab-' ; DCEdition='4'; Internet=$true ; AdditionalNetworksConfig=@(); VMs=@()}
# Windows Server 2019
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
Expand All @@ -18,7 +18,7 @@ $LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!'; Prefix = 'W
$LabConfig=@{
DomainAdminName='LabAdmin'; # Used during 2_CreateParentDisks (no affect if changed after this step)
AdminPassword='LS1setup!'; # Used during 2_CreateParentDisks. If changed after, it will break the functionality of 3_Deploy.ps1
Prefix = 'WSLab-'; # (Optional) All VMs and vSwitch are created with this prefix, so you can identify the lab. If not specified, Lab folder name is used
Prefix = 'MSLab-'; # (Optional) All VMs and vSwitch are created with this prefix, so you can identify the lab. If not specified, Lab folder name is used
SwitchName = 'LabSwitch'; # (Optional) Name of vSwitch
SecureBoot=$true; # (Optional) Useful when testing unsigned builds (Useful for MS developers for daily builds)
DCEdition='4'; # 4 for DataCenter or 3 for DataCenterCore
Expand All @@ -39,7 +39,7 @@ $LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!'; Prefix = 'W
DHCPscope="10.0.0.0"; # (Optional) 10.0.0.0 is configured if nothing is specified. Scope has to end with .0 (like 10.10.10.0). It's always /24
DCVMVersion="9.0"; # (Optional) Latest is used if nothing is specified. Make sure you use values like "8.0","8.3","9.0"
TelemetryLevel=""; # (Optional) If configured, script will stop prompting you for telemetry. Values are "None","Basic","Full"
TelemetryNickname=""; # (Optional) If configured, telemetry will be sent with NickName to correlate data to specified NickName. So when leaderboards will be published, WSLab users will be able to see their own stats
TelemetryNickname=""; # (Optional) If configured, telemetry will be sent with NickName to correlate data to specified NickName. So when leaderboards will be published, MSLab users will be able to see their own stats
AutoStartAfterDeploy=$false; # (Optional) If $false, no VM will be started; if $true or 'All' all lab VMs will be started after Deploy script; if 'DeployedOnly' only newly created VMs will be started.
InternetVLAN=""; # (Optional) If set, it will apply VLAN on Interent adapter connected to DC
AdditionalNetworksConfig=@(); # Just empty array for config below
Expand Down Expand Up @@ -181,11 +181,11 @@ $LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!'; Prefix = 'W
TelemetryLevel (optional)
Example: TelemetryLevel="Full"
If set, scripts will not prompt for telemetry. Can be "None","Basic","Full"
For more info see https://aka.ms/wslab/telemetry
For more info see https://aka.ms/mslab/telemetry
TelemetryNickname (optional)
Example: TelemetryNickname="Jaromirk"
If configured, telemetry will be sent with NickName to correlate data to specified NickName. So when leaderboards will be published, WSLab users will be able to see their own stats
If configured, telemetry will be sent with NickName to correlate data to specified NickName. So when leaderboards will be published, MSLab users will be able to see their own stats
#>
#endregion
Expand Down Expand Up @@ -278,7 +278,7 @@ $LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!'; Prefix = 'W
VMProcessorCount (Optional)
Example VMProcessorCount=8
Number of Processors in VM. If specified more than available in host, maximum possible number will be used.
If "Max" is specified, maximum number of VCPUs will be used (determined from host where wslab is running)
If "Max" is specified, maximum number of VCPUs will be used (determined from host where mslab is running)
Generation (Optional)
Example Generation=1
Expand Down
11 changes: 9 additions & 2 deletions Tools/PatchParentDisks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ If (-not $isAdmin) {
}else{
WriteErrorAndExit "No update package selected, exitting"
}

#sort packages by size (to apply Servicing Stack Update first)
if ($msupackages.Filenames){
$files=@()
foreach ($Filename in $msupackages.FileNames){$files+=Get-ChildItem -Path $filename}
$packages=($files |Sort-Object -Property Length).Fullname
}
#endregion

# region mount and patch VHD
Expand All @@ -80,8 +87,8 @@ If (-not $isAdmin) {
#Grab letter
$DriveLetter=(Get-Disk -Number $Mount.Number |Get-Partition | Where-Object Driveletter).DriveLetter
#Patch
foreach ($msupackage in $msupackages){
Add-WindowsPackage -PackagePath $msupackage.filename -Path "$($DriveLetter):\"
foreach ($package in $packages){
Add-WindowsPackage -PackagePath $package -Path "$($DriveLetter):\"
}
#Dismount
$Mount | Dismount-VHD
Expand Down

0 comments on commit 3ec7219

Please sign in to comment.