The first step in using the PowerCLI cmdlets is to connect to the vCentre or Virtual Centre server and that's done using Connect-VIServer
Once connected, you then have access to run the cmdlet's that are allowed as per your level of permissions in Virtual Centre. In my case I looked at the Get-Snapshot cmdlet, which accepts a VM name as an argument and returns details of any snapshots associated with the supplied VM name.
Using some basic PowerShell I was able to get a tabular list of all VMs with snapshots, showing the name of the VM, the date that the snapshot was created, the snapshot's name and description. Very handy for quickly finding those forgotten snapshots.
Get-VM * | Get-Snapshot | Select VM, Created, Name, Description
Using PowerShell with VMware looks to make those painful admin tasks easier but there was one 'gotcha' that i noticed. When finished using PowerShell, use the Disconnect-VIServer
1 comment:
Nice use case. I know other people with the same problem - finding and removing outdated snapshots. I took your example and expanded upon it - http://blog.powerwf.com/post/211248547/sample-workflow-virtual-machine-snapshot
Post a Comment