Here's a simple script to query all your VM's that currently have snapshots. 5 columns are created starting from VM, SnapShotName, Snapshot Description, Size (Snapshot), Date Created.
$Report = Get-VM | Get-Snapshot | Select VM,Name,Description,@{Label="Size";Expression={"{0:N2} GB" -f ($_.SizeGB)}},Created
If (-not $Report)
{ $Report = New-Object PSObject -Property @{
VM = "No snapshots found on any VM's controlled by $VIServer"
Name = ""
Description = ""
Size = ""
Created = ""
}
}
$Report = $Report | export-csv -path c:\tmp\vmware\snapshotsDAYMONTH.csv
Append "| export-csv -path c:\tmp\vmware\vm_tools_upgrade.csv" to the end of the script for viewing and reporting purposes.
PS > Snapshot.ps1
No comments:
Post a Comment