Pages: [1]
Print
Author Topic: Report number of ports per vswitch  (Read 859 times)
esarakaitis
Administrator
Sr. Member
*****
Posts: 256


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« on: February 09, 2010, 10:13:30 AM »

Code:
$report = @()
foreach ($vmhost in get-cluster | get-vmhost)
        {
        $switchinfo = get-virtualswitch $vmhost
        foreach ($vmswitch in $switchinfo) {
                $report += "" | select-object (
                           @{Name = "Name"; Expression = {$vmhost.name}},
                           @{Name = "Vswitch"; Expression = {$vmswitch.name}},
                           @{Name = "NumPorts"; Expression = {$vmswitch.numports}},
                           @{Name = "NumPortsAvailable"; Expression = {$vmswitch.NumPortsAvailable}}
        )                   
        }
        }
$report | Export-Csv c:\1.csv
Logged
Pages: [1]
Print
Jump to: