Hi Sir,
I tried to get the out put in arry and print the report still it is not changed. Any help will really helpful
My Script
$VIServer = "vcenter1","Vcenter2"
foreach($VCserver in $VIserver)
{
Connect-VIServer -Server $VIServer -Protocol https -User administrator -Password Pass@123
$Header = @"
<style>
TABLE {border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}
TH {border-width: 1px;padding: 3px;border-style: solid;border-color: black;background-color: #6495ED;}
TD {border-width: 1px;padding: 3px;border-style: solid;border-color: black;}
.odd { background-color:#ffffff; }
.even { background-color:#dddddd; }
</style>
<title>
Snapshot Report - $VcServer
</title>
"@
$Report = @()
$a = Get-VM | Get-Snapshot | Select VM,@{N="vCname";E={$VCserver}},Name,Description,Created,SizeMB,SizeGB
If (-not $a)
{ $a = New-Object PSObject -Property @{
VM = "No snapshots found on any VM's controlled by $VIServer"
Name = ""
Description = ""
SizeGB = ""
Created = ""
}
$Report += $a
}
$Report = $report |
Select VCname ,VM,Name,Description,SizeGB,Created |
ConvertTo-Html -Head $Header -PreContent "<p><h2>Snapshot Report</h2></p><br>" |
Set-AlternatingRows -CSSEvenClass even -CSSOddClass odd
$Report | Out-File "C:\VM-operations\dailyreport\SnapShotReport.html"
}