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"``` diff --git a/source/Private/Get-LabCertificatePsFileContent.ps1 b/source/Private/Get-LabCertificatePsFileContent.ps1 index e98b9f18..cd61f586 100644 --- a/source/Private/Get-LabCertificatePsFileContent.ps1 +++ b/source/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 ...' `` diff --git a/source/Private/Get-LabUnattendFileContent.ps1 b/source/Private/Get-LabUnattendFileContent.ps1 index c6135864..0f538a72 100644 --- a/source/Private/Get-LabUnattendFileContent.ps1 +++ b/source/Private/Get-LabUnattendFileContent.ps1 @@ -102,6 +102,7 @@ function Get-LabUnattendFileContent + "@ if ($VM.OSType -eq [LabOSType]::Client) { @@ -132,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 @@ -143,6 +157,10 @@ $unattendContent += @" true true + +"@ +} # If +$unattendContent += @" $($VM.AdministratorPassword) @@ -154,9 +172,6 @@ $unattendContent += @" false $($VM.TimeZone) - - true - true diff --git a/source/Private/Set-LabDSC.ps1 b/source/Private/Set-LabDSC.ps1 index 7f3bd22a..2fa74e18 100644 --- a/source/Private/Set-LabDSC.ps1 +++ b/source/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 diff --git a/source/prefix.ps1 b/source/prefix.ps1 index b5e5c9c5..6a2ce587 100644 --- a/source/prefix.ps1 +++ b/source/prefix.ps1 @@ -336,7 +336,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() {} @@ -430,7 +430,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