Pages: [1]
Print
Author Topic: List storage information per cluster, output to csv  (Read 374 times)
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« on: April 29, 2009, 06:20:24 AM »

Code:
$Col = @()
foreach ($cluster in Get-Cluster)
{
    $vmhosts = $cluster | Get-VMhost
   
    if (!$vmhosts) {continue}
   
    $firsthost = $vmhosts[0]
    $datastores = $firsthost | get-datastore | % {(Get-View $_.ID).summary}
    foreach ($datastore in $datastores)
    {
        $Col += $datastore | select-object @{Name = "Date"; Expression = {get-date}}, `
@{Name = "Cluster"; Expression = {$cluster.name}}, `
URL, Name, Freespace, Capacity
}
}
$col | Export-Csv c:\cpuinfo.csv
Logged
Pages: [1]
Print
Jump to: