Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/about_LabBuilderSchema.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"```

Expand Down
17 changes: 13 additions & 4 deletions source/Private/Get-LabCertificatePsFileContent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...' ``
Expand Down
23 changes: 19 additions & 4 deletions source/Private/Get-LabUnattendFileContent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ function Get-LabUnattendFileContent
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

"@
if ($VM.OSType -eq [LabOSType]::Client)
{
Expand Down Expand Up @@ -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 += @"
<OOBE>
<HideEULAPage>true</HideEULAPage>
<NetworkLocation>Work</NetworkLocation>
<ProtectYourPC>1</ProtectYourPC>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<SkipUserOOBE>true</SkipUserOOBE>
<SkipMachineOOBE>true</SkipMachineOOBE>
</OOBE>

"@
} else {
$unattendContent += @"
<OOBE>
<HideEULAPage>true</HideEULAPage>
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
Expand All @@ -143,6 +157,10 @@ $unattendContent += @"
<SkipUserOOBE>true</SkipUserOOBE>
<SkipMachineOOBE>true</SkipMachineOOBE>
</OOBE>

"@
} # If
$unattendContent += @"
<UserAccounts>
<AdministratorPassword>
<Value>$($VM.AdministratorPassword)</Value>
Expand All @@ -154,9 +172,6 @@ $unattendContent += @"
<DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
<TimeZone>$($VM.TimeZone)</TimeZone>
</component>
<component name="Microsoft-Windows-ehome-reg-inf" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RestartEnabled>true</RestartEnabled>
</component>
<component name="Microsoft-Windows-ehome-reg-inf" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RestartEnabled>true</RestartEnabled>
</component>
Expand Down
11 changes: 8 additions & 3 deletions source/Private/Set-LabDSC.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions source/prefix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

Expand Down Expand Up @@ -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
Expand Down