From d37a22614d1630c16e40c5213557170e4deda30a Mon Sep 17 00:00:00 2001 From: Chris Brucker Date: Sun, 9 Feb 2020 03:26:57 -0500 Subject: [PATCH 1/7] Win7/2008 Support --- .../private/Get-LabCertificatePsFileContent.ps1 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/lib/private/Get-LabCertificatePsFileContent.ps1 b/src/lib/private/Get-LabCertificatePsFileContent.ps1 index 1601f983..fbc9fc10 100644 --- a/src/lib/private/Get-LabCertificatePsFileContent.ps1 +++ b/src/lib/private/Get-LabCertificatePsFileContent.ps1 @@ -80,10 +80,19 @@ if (-not `$Cert) | Where-Object { `$_.FriendlyName -eq `$CertificateFriendlyName } } } -Export-Certificate `` - -Type CERT `` - -Cert `$Cert `` - -FilePath `"`$(`$ENV:SystemRoot)\$Script:DSCEncryptionCert`" +if ((Get-WmiObject -Class Win32_OperatingSystem).Version -eq '6.1.7601') { + `$content = @( + '-----BEGIN CERTIFICATE-----' + [System.Convert]::ToBase64String(`$cert.RawData, 'InsertLineBreaks') + '-----END CERTIFICATE-----' + ) + `$content | Out-File -FilePath `"`$(`$ENV:SystemRoot)\$Script:DSCEncryptionCert`" -Encoding ascii +} else { + Export-Certificate `` + -Type CERT `` + -Cert `$Cert `` + -FilePath `"`$(`$ENV:SystemRoot)\$Script:DSCEncryptionCert`" +} Add-Content `` -Path `"`$(`$ENV:SystemRoot)\Setup\Scripts\SetupComplete.log`" `` -Value 'Encryption Certificate Imported from CER ...' `` From d635cbe7ccdb90c946701f82cb4e4292086c3a8e Mon Sep 17 00:00:00 2001 From: Chris Brucker Date: Sun, 9 Feb 2020 03:28:07 -0500 Subject: [PATCH 2/7] Removed 32-bit OS Unattend Setting --- src/lib/private/Get-LabUnattendFileContent.ps1 | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lib/private/Get-LabUnattendFileContent.ps1 b/src/lib/private/Get-LabUnattendFileContent.ps1 index c6135864..b75f0f4a 100644 --- a/src/lib/private/Get-LabUnattendFileContent.ps1 +++ b/src/lib/private/Get-LabUnattendFileContent.ps1 @@ -154,9 +154,6 @@ $unattendContent += @" false $($VM.TimeZone) - - true - true From da21efafc27565eed73c7dba9fafe9ef1ab9f438 Mon Sep 17 00:00:00 2001 From: Chris Brucker Date: Sun, 9 Feb 2020 03:29:56 -0500 Subject: [PATCH 3/7] Fixed spacing issue --- src/lib/private/Get-LabUnattendFileContent.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/private/Get-LabUnattendFileContent.ps1 b/src/lib/private/Get-LabUnattendFileContent.ps1 index b75f0f4a..1485af49 100644 --- a/src/lib/private/Get-LabUnattendFileContent.ps1 +++ b/src/lib/private/Get-LabUnattendFileContent.ps1 @@ -102,6 +102,7 @@ function Get-LabUnattendFileContent + "@ if ($VM.OSType -eq [LabOSType]::Client) { From 8757fba986814a1ec2b037b875e16597eebea91f Mon Sep 17 00:00:00 2001 From: Chris Brucker Date: Sun, 9 Feb 2020 03:32:06 -0500 Subject: [PATCH 4/7] OOBE changes to support Win7/2008 --- .../private/Get-LabUnattendFileContent.ps1 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/lib/private/Get-LabUnattendFileContent.ps1 b/src/lib/private/Get-LabUnattendFileContent.ps1 index 1485af49..0f538a72 100644 --- a/src/lib/private/Get-LabUnattendFileContent.ps1 +++ b/src/lib/private/Get-LabUnattendFileContent.ps1 @@ -133,7 +133,20 @@ function Get-LabUnattendFileContent "@ } # If -$unattendContent += @" + if (($VM.Name -like '*7*' -or $VM.Name -like '*2008*') -and $VM.Name -notlike '*10*') { + $unattendContent += @" + + true + Work + 1 + true + true + true + + +"@ + } else { + $unattendContent += @" true true @@ -144,6 +157,10 @@ $unattendContent += @" true true + +"@ +} # If +$unattendContent += @" $($VM.AdministratorPassword) From 20a522ede087be5ad8baea78c2e6cea0a5412ed8 Mon Sep 17 00:00:00 2001 From: Chris Brucker Date: Sun, 9 Feb 2020 04:01:42 -0500 Subject: [PATCH 5/7] Win7/2008 Support --- src/lib/private/Set-LabDSC.ps1 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/private/Set-LabDSC.ps1 b/src/lib/private/Set-LabDSC.ps1 index 7f3bd22a..2fa74e18 100644 --- a/src/lib/private/Set-LabDSC.ps1 +++ b/src/lib/private/Set-LabDSC.ps1 @@ -71,6 +71,7 @@ function Set-LabDSC } # if $macAddress = $netAdapter.MacAddress + $mac = $macAddress.insert(2,":").insert(5,":").insert(8,":").insert(11,":").insert(14,":") if (-not $macAddress) { @@ -84,9 +85,13 @@ function Set-LabDSC } # If $dscStartPs += @" -Get-NetAdapter `` - | Where-Object { `$_.MacAddress.Replace('-','') -eq '$macAddress' } `` - | Rename-NetAdapter -NewName '$($adapter)' +if ((Get-WmiObject -Class Win32_OperatingSystem).Version -eq '6.1.7601') { + Set-CimInstance -Query "Select * from Win32_NetworkAdapter where MACAddress ='$mac'" -Property @{NetConnectionID="$adapter"} +} else { + Get-NetAdapter `` + | Where-Object { `$_.MacAddress.Replace('-','') -eq '$macAddress' } `` + | Rename-NetAdapter -NewName '$($adapter)' +} "@ } # Foreach From d6f7333e73b24883432857ce0696e7d4c54a6e5e Mon Sep 17 00:00:00 2001 From: Chris Brucker Date: Mon, 10 Feb 2020 00:05:51 -0500 Subject: [PATCH 6/7] Add Server 2019 Hyper-V Config Version Support --- src/LabBuilder.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LabBuilder.psm1 b/src/LabBuilder.psm1 index b19d2d4f..e11cfeed 100644 --- a/src/LabBuilder.psm1 +++ b/src/LabBuilder.psm1 @@ -329,7 +329,7 @@ class LabVMTemplate:System.ICloneable { [System.String[]] $IntegrationServices = @('Guest Service Interface','Heartbeat','Key-Value Pair Exchange','Shutdown','Time Synchronization','VSS') [System.String[]] $Packages [ValidateRange(1,2)][Byte] $Generation = 2 - [ValidateSet("5.0","6.2","7.0","7.1","8.0","254.0","255.0")][System.String] $Version = '8.0' + [ValidateSet("5.0","6.2","7.0","7.1","8.0","9.0","254.0","255.0")][System.String] $Version = '8.0' LabVMTemplate() {} @@ -423,7 +423,7 @@ class LabVM:System.ICloneable { [System.String] $SetupComplete [System.String[]] $Packages [ValidateRange(1,2)][Byte] $Generation = 2 - [ValidateSet("5.0","6.2","7.0","7.1","8.0","254.0","255.0")][System.String] $Version = '8.0' + [ValidateSet("5.0","6.2","7.0","7.1","8.0","9.0","254.0","255.0")][System.String] $Version = '8.0' [System.Int32] $BootOrder [System.String[]] $IntegrationServices = @('Guest Service Interface','Heartbeat','Key-Value Pair Exchange','Shutdown','Time Synchronization','VSS') [LabVMAdapter[]] $Adapters From 444ef295671867510dddadf4087fd923e1ce366a Mon Sep 17 00:00:00 2001 From: Chris Brucker Date: Mon, 10 Feb 2020 00:07:23 -0500 Subject: [PATCH 7/7] Support Server 2019 Hyper-V Config Version --- docs/about_LabBuilderSchema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/about_LabBuilderSchema.md b/docs/about_LabBuilderSchema.md index e72f3be5..cb81cf54 100644 --- a/docs/about_LabBuilderSchema.md +++ b/docs/about_LabBuilderSchema.md @@ -720,7 +720,7 @@ This optional attribute controls the Virtual Machine generation to create. This optional attribute controls the Virtual Machine Version to create, this is only applicable to Windows 10 build 14352 or higher/Server 2016 post TP5. - Default Value: 8.0 -- Valid Values: 5.0, 6.2, 7.0, 7.1, 8.0, 254.0, and 255.0 +- Valid Values: 5.0, 6.2, 7.0, 7.1, 8.0, 9.0, 254.0, and 255.0 ```version="5.0"```