Originally published February 20, 2017 @ 1:21 am

Below is a collection of useful Power-CLI one-liners (or thereabouts) that can speed up your script-writing efforts. As everything Windows, things change often and for no obvious reason, so expect to see type is deprecated and parameter is obsolete warnings now and then.More often than not, they’re harmless: they like changing things but usually don’t have the balls to actually remove something.

Entering the Chicken Coop
Cluster Info

Get some info on the basket with all of your eggs

Glorious Spreadsheets

Creating spreadsheets

Get a list of templates with name matching:

Get a list of VMs with name matching:

Get VM details:

Below is a quick PowerShell script to gather VM details based on the VM name regular expression. Note the Where-Object syntax and modify to suit your needs.

Generate a datastore audit report in CSV format showing capacity, provisioned, and available space

Same as above, but one cluster per Excel spreadsheet tab

Generate a VMDK report in Excel format showing VM name, datastore, VMDK path, storage format, and capacity


Wasting Disks

Get a list of Snapshots

Create Snapshots

Delete the Snapshots

Disk Consolidation

Abusing CPUs

Hogging RAM