Home > PowerCLI, Powershell > Snapshot information from PowerCLI

Snapshot information from PowerCLI

September 6th, 2010

Here are some PowerCLI single line scripts for getting different snapshot information:

Display VM Name and Snapshot Name

Get-VM | Get-Snapshot | select @{name="VM Name"; Expression={$_.vm.name}},name

Display VM Name, PowerState, Host and Snapshot Name

Get-VM | Get-Snapshot | select @{name="VM Name"; Expression={$_.vm.name}},@{name="Power State"; Expression={$_.vm.Powerstate}},@{name="Host"; Expression={$_.vm.Host}},name

Display VM Name and Number of Snapshots

Get-VM | Where{(Get-SnapShot -VM $_ | Measure-Object).Count -gt 0} | Format-Table Name, @{Label="NumSnapshots";Expression={(Get-Snapshot -VM $_ | Measure-Object).Count}}

All snapshots older than a particular date, say 30 days?

Get-VM | Get-Snapshot | Where { $_.Created -lt (Get-Date).AddDays(-0)} | select @{name="VM Name"; Expression={$_.vm.name}},@{name="Power State"; Expression={$_.vm.Powerstate}},name, Created
  1. December 15th, 2011 at 12:50 | #1

    Visit us now to buy more facts and facts regarding By us contemporary to buy more knowledge and facts regarding łowiectwo

  1. No trackbacks yet.
Comments are closed.