#Taking the input from user
$File_Name = Read-Host "Provide the filename that contains the list of Servers "
$VM_list = Get-Content "$File_Name"
Write-Host "VMName`t`t`t SnapShot Name`t`t`t`t`t Size of Snapshot"
# Checking each Server one by one
foreach($CHK_VM in $VM_List) {
$Cap_VM_Info = Get-VM $CHK_VM | Get-Snapshot | Select VM, Name, SizeGB
$Name = $Cap_VM_Info.VM
$SnapshotName = $Cap_VM_Info.Name
$SizeOfSnapshot = $Cap_VM_Info.SizeGB
Write-Host "$Name`t`t$SnapshotName`t`t`t$SizeOfSnapshot"
}
Get-VM | Sort Name | Get-Snapshot | Where { $_.Name.Length -gt 0 } | Select VM,Name,Created,SizeMB
No comments:
Post a Comment