PowerShell, Scripts

PowerShell – vSphere PowerCLI – Export Current Snapshots

Below is a PowerShell script I wrote within VMWare PowerCLI 5.5 which finds and exports a list of snapshots in a VMWare environment to a CSV file.

The exported details include;

  • the associated VM name and state
  • the description of the snapshot
  • when the snapshot was created
  • size of the snapshot

Again, please note this was created using PowerCLI version 5.5

You can also grab the full script here: Script

#PowerShell Script to Export Current Snapshots to CSV file
#Script to be ran using vSphere PowerCLI
#Script created using vSphere PowerCLI 5.5
#April 2016

#vSphere ServerName
$VIServer = "VCS01"

#CSV File Export Location and File name
$exportcsv = "D:\Current_Snapshots.csv"

add-pssnapin VMware.VimAutomation.Core
Connect-VIServer $VIServer
Start-Sleep -s 25
Get-VM |Get-Snapshot | Sort-Object VM | Select Name,Description,Created,VM,SizeGb,PowerState | Export-Csv $exportcsv -force


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s