HI ,
I need to get the out put this report to formatted table and send as html
Connect-VIServer Server -user "username" -Password "password"
ForEach ($VM in Get-VM | where-object {($_.powerstate -ne "PoweredOff") -and ($_.Extensiondata.Guest.ToolsStatus -Match ".*Ok.*")}){
ForEach ($Drive in $VM.Extensiondata.Guest.Disk) {
$Path = $Drive.DiskPath
#Calculations
$Freespace = [math]::Round($Drive.FreeSpace / 1MB)
$Capacity = [math]::Round($Drive.Capacity/ 1MB)
$SpaceOverview = "$Freespace" + "/" + "$capacity"
$PercentFree = [math]::Round(($FreeSpace)/ ($Capacity) * 100)
if ($PercentFree -lt 10) {
$Output = $Output + "VM: " + $VM.Name + "`n"
$Output = $Output + "Disk: " + $Path + "`n"
$OutPut = $Output + "Free(MB): " + $Freespace + "`n"
$Output = $Output + "Free(%): " + $PercentFree + "`n"
}
}
}
$Output | Out-File \path\report.csv