Skip to content

Commit

Permalink
Merge pull request #484 from microsoft/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jaromirk authored Jan 17, 2022
2 parents 1633559 + 02de1ec commit 50cb861
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
20 changes: 14 additions & 6 deletions Scripts/3_Deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -598,13 +598,19 @@ If (-not $isAdmin) {
}
#configure native VLAN and AllowedVLANs
WriteInfo "`t Configuring NativeVLAN and AllowedVLANs"
if ($ManagementSubnetIDs){
$AllowedVLANs="$($LabConfig.AllowedVLANs),$(($HighestVLAN+1))-$($HighestVLAN+$($ManagementSubnetIDs.Count))"
}else{
$AllowedVLANs=$($LabConfig.AllowedVLANs)
}

if ($VMConfig.ManagementSubnetID -gt 0){
$NativeVlanId=($HighestVLAN+$VMConfig.ManagementSubnetID)
WriteInfo "`t`t Subnet ID is $($VMConfig.ManagementSubnetID) with NativeVLAN $NativeVLanID. AllowedVLANIDList is $($LabConfig.AllowedVLANs),$NativeVLANID"
$VMTemp | Set-VMNetworkAdapterVlan -VMNetworkAdapterName "Management*" -Trunk -NativeVlanId $NativeVlanId -AllowedVlanIdList "$($LabConfig.AllowedVLANs),$NativeVLANID"
$VMTemp | Set-VMNetworkAdapterVlan -VMNetworkAdapterName "Management*" -Trunk -NativeVlanId $NativeVlanId -AllowedVlanIdList "$AllowedVLANs"
}else{
WriteInfo "`t`t Subnet ID is 0 with NativeVLAN 0. AllowedVlanIDList is $($LabConfig.AllowedVLANs)"
$VMTemp | Set-VMNetworkAdapterVlan -VMNetworkAdapterName "Management*" -Trunk -NativeVlanId 0 -AllowedVlanIdList "$($LabConfig.AllowedVLANs)"
$VMTemp | Set-VMNetworkAdapterVlan -VMNetworkAdapterName "Management*" -Trunk -NativeVlanId 0 -AllowedVlanIdList "$AllowedVLANs"
}

#Create Unattend file
Expand Down Expand Up @@ -756,8 +762,10 @@ If (-not $isAdmin) {
[int]$HighestVLAN=$LabConfig.AllowedVLANs -split "," -split "-" | Select -Last 1

#Grab defined Management Subnet IDs and ignore 0
$ManagementSubnetIDs=$labconfig.vms.ManagementSubnetID | Select-Object -Unique | Sort-Object | Where-Object {$_ -ne 0}
WriteInfo "`t Requested ManagementSubnetIDs: $ManagementSubnetIDs"
$ManagementSubnetIDs=$labconfig.vms.ManagementSubnetID + $LabConfig.ManagementSubnetIDs | Select-Object -Unique | Sort-Object | Where-Object {$_ -ne 0}
if ($ManagementSubnetIDs){
WriteInfo "`t Requested ManagementSubnetIDs: $ManagementSubnetIDs"
}

#endregion

Expand Down Expand Up @@ -1308,8 +1316,8 @@ If (-not $isAdmin) {
#add dhcp scope
Write-Output "`t`t Adding DHCP Scope ID 10.0.$number.0 and it's DHCP options"
Add-DhcpServerv4Scope -StartRange "10.0.$number.10" -EndRange "10.0.$number.254" -Name "Scope$number" -State Active -SubnetMask 255.255.255.0
Set-DhcpServerv4OptionValue -OptionId 6 -Value "10.0.0.1" -ScopeId "10.0.$number.0"
Set-DhcpServerv4OptionValue -OptionId 3 -Value "10.0.1.1" -ScopeId "10.0.$number.0"
Set-DhcpServerv4OptionValue -OptionId 6 -Value "10.0.$number.1" -ScopeId "10.0.$number.0"
Set-DhcpServerv4OptionValue -OptionId 3 -Value "10.0.$number.1" -ScopeId "10.0.$number.0"
Set-DhcpServerv4OptionValue -OptionId 15 -Value "$($using:Labconfig.DomainName)" -ScopeId "10.0.$number.0"
}
}
Expand Down
8 changes: 6 additions & 2 deletions Scripts/LabConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ $LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!'; Prefix = 'M
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
AutoStartAfterDeploy=$false; # (Optional) If $false, no VM will be started; if $true or 'All' all lab VMs will be started after Deploy script; if 'DeployedOnly' only newly created VMs will be started.
InternetVLAN=""; # (Optional) If set, it will apply VLAN on Interent adapter connected to DC
ManagementSubnetIDs=""; # (Optional) If set, it will add another dhcp-enable management networks.
AdditionalNetworksConfig=@(); # Just empty array for config below
VMs=@(); # Just empty array for config below
}
Expand Down Expand Up @@ -178,16 +179,19 @@ $LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!'; Prefix = 'M
DCVMVersion
Example: DCVMVersion="8.0" (optional)
If set, version for DC will be used. It is useful if you want to keep DC older to be able to use it on previous versions of OS.
TelemetryLevel (optional)
Example: TelemetryLevel="Full"
If set, scripts will not prompt for telemetry. Can be "None","Basic","Full"
For more info see https://aka.ms/mslab/telemetry
TelemetryNickname (optional)
Example: TelemetryNickname="Jaromirk"
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
ManagementSubnetIDs
Example: ManagementSubnetIDs=0..3
If configured, it will add another management subnet. For example if configured 0..3, it will add 3 more subnets 10.0.1.0/24 to 10.0.3.0/24 on VLANs that 11,12, and 13. (Because allowed VLANs are 1-10)
#>
#endregion

Expand Down
6 changes: 3 additions & 3 deletions Tools/PatchParentDisks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ If (-not $isAdmin) {
#endregion

# region mount and patch VHD
foreach ($VHD in $VHDs) {
WriteInfoHighlighted "Patching VHD $($VHD.Filename)"
$Mount=Mount-VHD $Vhd.FileName -Passthru
foreach ($FileName in $VHDs.FileNames) {
WriteInfoHighlighted "Patching VHD $FileName"
$Mount=Mount-VHD $FileName -Passthru
#Grab letter
$DriveLetter=(Get-Disk -Number $Mount.Number |Get-Partition | Where-Object Driveletter).DriveLetter
#Patch
Expand Down

0 comments on commit 50cb861

Please sign in to comment.