Hi All,
Just wondering if anyone here knows of a way (script) to list distributed portgroups that haven't got VM's connected to it?
Thanks Nic
Try something like this
Get-VDPortgroup | where{$_.ExtensionData.Vm.Count -eq 0} | select VDSwitch,Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try something like this
Get-VDPortgroup | where{$_.ExtensionData.Vm.Count -eq 0} | select VDSwitch,Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Luc,
You are amazing, its exactly what I needed, by any chance would it be possible to add the VLAN ID to that unused portgroup list ?
Sure, try like this
Get-VDPortgroup | where{$_.ExtensionData.Vm.Count -eq 0} |
select VDSwitch,Name,
@{N='VlanType';E={$_.VlanConfiguration.VlanType}},
@{N='VlanId';E={
$pg = $_
switch($pg.VlanConfiguration.VlanType){
'Vlan' {$pg.VlanConfiguration.VlanId}
'PrivateVlan' {"$($pg.VlanConfiguration.PrimaryVlanId )-$($pg.VlanConfiguration.SecondaryVlanId)"}
'Trunk' {$pg.VlanConfiguration.Ranges}
}
}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Luc,
I just want to say thank you, this helped us so much and saved us hours of work.
Thanks Nic