Pages: [1]
Print
Author Topic: create web page from list of vm's and the cluster they are on  (Read 644 times)
esarakaitis
Administrator
Sr. Member
*****
Posts: 256


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« on: July 30, 2009, 01:47:13 PM »

Code:
$a = "<style>"
$a = $a + "BODY{background-color:white;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}"
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:palegoldenrod}"
$a = $a + "</style>"
$viServers = @()
$viServers += Connect-ViServer "vc01"
$viServers += Connect-ViServer "vc02"
$viServers += Connect-ViServer "vc03"
$report = @()
$clusters = get-cluster -Server $viServers

foreach ($cluster in $clusters)
{
    foreach ($vmhost in ($cluster | get-vmhost))
    {
      $report += $vmhost | get-vm | Select-Object @{Name="Cluster"; Expression={$cluster.name}},`
            Name
    }
}
$report | ConvertTo-HTML -head $a | Out-File C:\index.htm
Logged
Pages: [1]
Print
Jump to: