Skip to content

Commit e4e83bd

Browse files
authored
Merge pull request #619 from microsoft/mattmcspirit-patch-2
Update LabConfig.ps1
2 parents db18377 + b76567d commit e4e83bd

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

Scripts/0_DCHydrate.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ function Hydrate-DC {
9696
[parameter(Mandatory=$true)]
9797
[string]$DhcpScope,
9898

99+
[parameter(Mandatory=$true)]
100+
[string]$DhcpScopeState,
101+
99102
[parameter(Mandatory=$true)]
100103
[string]$AdminPassword)
101104

@@ -396,8 +399,8 @@ function Hydrate-DC {
396399
IPEndRange = ($DhcpScope+"254")
397400
Name = 'ManagementScope'
398401
SubnetMask = '255.255.255.0'
399-
LeaseDuration = '00:08:00'
400-
State = 'Active'
402+
LeaseDuration = ((New-TimeSpan -Hours 8).ToString())
403+
State = $DHCPScopeState
401404
AddressFamily = 'IPv4'
402405
DependsOn = "[Service]DHCPServer"
403406
}

Scripts/3_Deploy.ps1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,16 @@ If (-not $isAdmin) {
947947
$LabConfig.DHCPscope="10.0.0.0"
948948
}
949949

950+
if (!$LabConfig.DHCPscopeActive){
951+
$DHCPScopeState = 'Active'
952+
}
953+
elseif ($LabConfig.DHCPscopeActive -eq $false){
954+
$DHCPScopeState = 'Inactive'
955+
}
956+
else {
957+
$DHCPScopeState = 'Active'
958+
}
959+
950960
WriteInfoHighlighted "List of variables used"
951961
WriteInfo "`t Prefix used in lab is $($labconfig.prefix)"
952962

@@ -1287,7 +1297,7 @@ If (-not $isAdmin) {
12871297
$VMPath="$PSScriptRoot\LAB\"
12881298
$HydrationSwitchname="DC_HydrationSwitch_$([guid]::NewGuid())"
12891299

1290-
Hydrate-DC -DCName $DCName -VhdPath $vhdpath -VMPath $VMPath -Switchname $HydrationSwitchname -TimeZone $TimeZone -DHCPScope $LabConfig.DHCPscope -AdminPassword $LabConfig.AdminPassword
1300+
Hydrate-DC -DCName $DCName -VhdPath $vhdpath -VMPath $VMPath -Switchname $HydrationSwitchname -TimeZone $TimeZone -DHCPScope $LabConfig.DHCPscope -DHCPScopeState $DHCPScopeState -AdminPassword $LabConfig.AdminPassword
12911301
$DC=Get-VM -Name $DCName
12921302
if ($DC -eq $null){
12931303
WriteErrorAndExit "DC was not created successfully Press any key to continue ..."

Scripts/LabConfig.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ $LabConfig=@{AllowedVLANs="1-10,711-719" ; DomainAdminName='LabAdmin'; AdminPass
3737
EnableGuestServiceInterface=$false; # (Optional) If True, then Guest Services integration component will be enabled on all VMs.
3838
DCVMProcessorCount=2; # (Optional) 2 is default. If specified more/less, processorcount will be modified.
3939
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
40+
DHCPscopeActive=$true; # (Optional) If set to $false, DHCP Scope is created, but set to 'Inactive'
4041
DCVMVersion="9.0"; # (Optional) Latest is used if nothing is specified. Make sure you use values like "8.0","8.3","9.0"
4142
TelemetryLevel=""; # (Optional) If configured, script will stop prompting you for telemetry. Values are "None","Basic","Full"
4243
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

0 commit comments

Comments
 (0)