Skip to content

Commit

Permalink
support for SwitchNICs - fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jaromirk committed Aug 25, 2021
1 parent 06d4d94 commit 5bd6c0b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Scripts/3_Deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ If (-not $isAdmin) {
$vSwitches | Select-Object Name,NetAdapterInterfaceDescriptions
WriteErrorAndExit "At least one NIC is connected to existing Virtual Switch, different than specified in Labconfig ($SwitchName)"
}else{
New-VMSwitch -SwitchType External -Name $SwitchName -EnableEmbeddedTeaming $true -EnableIov $true -NetAdapterName $LabConfig.SwitchNics -AllowManagementOS $False
New-VMSwitch -Name $SwitchName -EnableEmbeddedTeaming $true -EnableIov $true -NetAdapterName $LabConfig.SwitchNics -AllowManagementOS $False
}
}else{
New-VMSwitch -SwitchType Private -Name $SwitchName
Expand Down Expand Up @@ -958,7 +958,7 @@ If (-not $isAdmin) {
WriteSuccess "`t External vSwitch $ExternalSwitchName detected"
}else{
WriteInfo "`t Detecting external VMSwitch"
$ExtSwitch=Get-VMSwitch -SwitchType External
$ExtSwitch=Get-VMSwitch -SwitchType External | Where-Object Name -NotLike $SwitchName
if (!$ExtSwitch){
WriteInfoHighlighted "`t No External Switch detected. Will create one "
$TempNetAdapters=get-netadapter | Where-Object Name -NotLike vEthernet* | Where-Object status -eq up
Expand Down
3 changes: 3 additions & 0 deletions Scripts/Cleanup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ If (-not $isAdmin) {
if (-not ($LabConfig.Prefix)){
$labconfig.Prefix="$($PSScriptRoot | Split-Path -Leaf)-"
}
if (-not ($LabConfig.SwitchName)){
$labconfig.SwitchName="LabSwitch"
}

#grab all VMs, switches and DC
$VMs=Get-VM -Name "$($LabConfig.Prefix)*" | Where-Object Name -ne "$($LabConfig.Prefix)DC" -ErrorAction SilentlyContinue | Sort-Object -Property Name
Expand Down
2 changes: 1 addition & 1 deletion Scripts/LabConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!'; Prefix = 'M
AdminPassword='LS1setup!'; # Used during 2_CreateParentDisks. If changed after, it will break the functionality of 3_Deploy.ps1
Prefix = 'MSLab-'; # (Optional) All VMs and vSwitch are created with this prefix, so you can identify the lab. If not specified, Lab folder name is used
SwitchName = 'LabSwitch'; # (Optional) Name of vSwitch
SwitchNICs = 'NIC1",NIC2" ; # (Optional) Adds these NICs to vSwitch (without connecting host).
SwitchNICs = 'NIC1",NIC2" ; # (Optional) Adds these NICs to vSwitch (without connecting hostOS).
SecureBoot=$true; # (Optional) Useful when testing unsigned builds (Useful for MS developers for daily builds)
DCEdition='4'; # 4 for DataCenter or 3 for DataCenterCore
InstallSCVMM='No'; # (Optional) Yes/Prereqs/SQL/ADK/No
Expand Down

0 comments on commit 5bd6c0b

Please sign in to comment.