mpeneva's Accepted Solutions

Do you have the module loaded in the session you've invoked the corresponding 'Get-' command ?
Sorry for the extra bracket in the second line. Below is my suggestion: $vcConnection = Connect-VIServer -Server <server_IP? -User <user_name> -Password <user_password> $dc = Get-Datacenter -Server... See more...
Sorry for the extra bracket in the second line. Below is my suggestion: $vcConnection = Connect-VIServer -Server <server_IP? -User <user_name> -Password <user_password> $dc = Get-Datacenter -Server $vcConnection $objects = $dc | Get-VMHost -Server $vcConnection| Get-VirtualPortGroup -Server $vcConnection foreach($obj in $objects) { $clusterResult = $dc | Get-Cluster -Server $vcConnection foreach ($cluster in $clusterResult) { $vmHost = $cluster | Get-VMHost $vmHost | Get-VirtualPortGroup | ? {$_.Name -eq $obj.Name} | select @{N='Datacenter'; E = {$dc.Name}}, @{N = 'Portgroup'; E = {$obj.Name}}, @{N = 'VLanId'; E = {$obj.VLanId}}, @{N = 'ClusterName'; E = {$cluster.Name}}, @{N = 'VCenter' ; E={$vcConnection}}, @{N = 'VMHostCount'; E = {$vmHost.Count}}, @{N = 'VMCount'; E = {($vmHost|Get-VM).Count}} } }  
You are right Luc. It said only "virtual switches".
I think that you need to use Get-VDSecurityPolicy for distributed switches