Hi,
Please help me in adding the Title to the first Row of the Script. Below is the script
$report = Get-VM | Group-Object -Property {$_.Folder.Id} | Select @{N="Folder Name";E={$folder = $_.Group[0].Folder; $path = $folder.Name; $path}},
@{N="Cluster";E={Get-Cluster -VM $_.Group}},
@{N="CPU";E={$_.Group | Measure-Object -Property NumCpu -Sum | Select -ExpandProperty Sum}},
@{N="Memory(GB)";E={$_.Group | Measure-Object -Property MemoryGB -Sum | Select -ExpandProperty Sum}},
@{N="ProvisionedSpace(GB)";E={"{0:f1}" -f ($_.Group | Measure-Object -Property ProvisionedSpaceGB -Sum | Select -ExpandProperty Sum)}},
@{N="Total VM's";E={$_.Group.Count}},
@{N="PoweredOn VM's";E={($_.Group | Where-Object {$_.PowerState -eq "PoweredOn"}).Count}},
@{N="PoweredOff VM's";E={($_.Group | Where-Object {$_.PowerState -eq "PoweredOff"}).Count}}
$sum = $report | Measure-Object -sum "CPU", "Memory(GB)", "ProvisionedSpace(GB)", "Total VM's", "PoweredOn VM's", "PoweredOff VM's"
$row1 = "" | Select "Folder Name","Cluster","CPU","Memory(GB)","ProvisionedSpace(GB)","Total VM's","PoweredOn VM's","PoweredOff VM's"
$report += $row1
$row2 = "" | Select "Folder Name","Cluster","CPU","Memory(GB)","ProvisionedSpace(GB)","Total VM's","PoweredOn VM's","PoweredOff VM's"
$row2."Folder Name" = 'Total' -- Also I would like to Bold this row
$row2.CPU = $sum | where{$_.Property -eq 'CPU'} | select -ExpandProperty Sum
$row2."Memory(GB)" = $sum | where{$_.Property -eq "Memory(GB)"} | select -ExpandProperty Sum
$row2."ProvisionedSpace(GB)" = $sum | where{$_.Property -eq "ProvisionedSpace(GB)"} | select -ExpandProperty Sum
$row2."Total VM's" = $sum | where{$_.Property -eq "Total VM's"} | select -ExpandProperty Sum
$row2."PoweredOn VM's" = $sum | where{$_.Property -eq "PoweredOn VM's"} | select -ExpandProperty Sum
$row2."PoweredOff VM's" = $sum | where{$_.Property -eq "PoweredOff VM's"} | select -ExpandProperty Sum
$report += $row2
$report | Export-Excel -Path $reportlocation -WorksheetName Summary