diff --git a/Scripts/0_DCHydrate.ps1 b/Scripts/0_DCHydrate.ps1 index dea0c3ca..e59a9f2e 100644 --- a/Scripts/0_DCHydrate.ps1 +++ b/Scripts/0_DCHydrate.ps1 @@ -96,6 +96,9 @@ function Hydrate-DC { [parameter(Mandatory=$true)] [string]$DhcpScope, + [parameter(Mandatory=$true)] + [string]$DhcpScopeState, + [parameter(Mandatory=$true)] [string]$AdminPassword) @@ -396,8 +399,8 @@ function Hydrate-DC { IPEndRange = ($DhcpScope+"254") Name = 'ManagementScope' SubnetMask = '255.255.255.0' - LeaseDuration = '00:08:00' - State = 'Active' + LeaseDuration = ((New-TimeSpan -Hours 8).ToString()) + State = $DHCPScopeState AddressFamily = 'IPv4' DependsOn = "[Service]DHCPServer" } diff --git a/Scripts/3_Deploy.ps1 b/Scripts/3_Deploy.ps1 index 88afbeb1..21e236a7 100644 --- a/Scripts/3_Deploy.ps1 +++ b/Scripts/3_Deploy.ps1 @@ -947,6 +947,16 @@ If (-not $isAdmin) { $LabConfig.DHCPscope="10.0.0.0" } + if (!$LabConfig.DHCPscopeActive){ + $DHCPScopeState = 'Active' + } + elseif ($LabConfig.DHCPscopeActive -eq $false){ + $DHCPScopeState = 'Inactive' + } + else { + $DHCPScopeState = 'Active' + } + WriteInfoHighlighted "List of variables used" WriteInfo "`t Prefix used in lab is $($labconfig.prefix)" @@ -1287,7 +1297,7 @@ If (-not $isAdmin) { $VMPath="$PSScriptRoot\LAB\" $HydrationSwitchname="DC_HydrationSwitch_$([guid]::NewGuid())" - Hydrate-DC -DCName $DCName -VhdPath $vhdpath -VMPath $VMPath -Switchname $HydrationSwitchname -TimeZone $TimeZone -DHCPScope $LabConfig.DHCPscope -AdminPassword $LabConfig.AdminPassword + Hydrate-DC -DCName $DCName -VhdPath $vhdpath -VMPath $VMPath -Switchname $HydrationSwitchname -TimeZone $TimeZone -DHCPScope $LabConfig.DHCPscope -DHCPScopeState $DHCPScopeState -AdminPassword $LabConfig.AdminPassword $DC=Get-VM -Name $DCName if ($DC -eq $null){ WriteErrorAndExit "DC was not created successfully Press any key to continue ..." diff --git a/Scripts/LabConfig.ps1 b/Scripts/LabConfig.ps1 index a026d3e2..825d7829 100644 --- a/Scripts/LabConfig.ps1 +++ b/Scripts/LabConfig.ps1 @@ -37,6 +37,7 @@ $LabConfig=@{AllowedVLANs="1-10,711-719" ; DomainAdminName='LabAdmin'; AdminPass EnableGuestServiceInterface=$false; # (Optional) If True, then Guest Services integration component will be enabled on all VMs. DCVMProcessorCount=2; # (Optional) 2 is default. If specified more/less, processorcount will be modified. 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 + DHCPscopeActive=$true; # (Optional) If set to $false, DHCP Scope is created, but set to 'Inactive' 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, MSLab users will be able to see their own stats