I have a script that checks dvswitch properties. Currently I exclude management dvSwitches by name. I am trying to figure out how to exclude management dvSwitches (no VM dvPortgroups) from my object via code. For example:
In this example only want it to return dvswitch2
Something like this?
Get-VDSwitch | ForEach-Object -Process {
$tab.Add($_.Name,'')
}
Get-VMHostNetworkAdapter -VMKernel |
ForEach-Object -Process {
Get-VDPortgroup -Name $_.PortGroupName -ErrorAction SilentlyContinue |
Get-VDSwitch | ForEach-Object -Process {
$tab.Remove($_.Name)
}
}
$tab.GetEnumerator()
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Something like this?
Get-VDSwitch | ForEach-Object -Process {
$tab.Add($_.Name,'')
}
Get-VMHostNetworkAdapter -VMKernel |
ForEach-Object -Process {
Get-VDPortgroup -Name $_.PortGroupName -ErrorAction SilentlyContinue |
Get-VDSwitch | ForEach-Object -Process {
$tab.Remove($_.Name)
}
}
$tab.GetEnumerator()
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Luc,
As always thanks SO MUCH!