pluralsight/PS-AutoLab-Env

`Wipe-Lab -RemoveSwitch` only removes NetNat, but not Switch

andreasjordan opened this issue · 0 comments

Not sure if bug or feature, but the code only runs Remove-NetNat and not Remove-VMSwitch:

if ($RemoveSwitch) {
Write-Verbose "Removing the Hyper-V switch"
$removeParams.Add("RemoveSwitch", $True)
# Delete NAT
$NatName = $Labdata.AllNodes.IPNatName
if ($pscmdlet.ShouldProcess("LabNat", "Remove NetNat")) {
Write-Verbose "Remoting NetNat"
Remove-NetNat -Name $NatName
}
}

So I had to also run Remove-VMSwitch -Name $Labdata.AllNodes.Lability_SwitchName.