Script to collect VM info

I have never written a powershell script before, but from what I understand, this will be the best way to collect the info that I need.

We need to start pulling reports to collect the following info on all the VMs in our vmware environment, and export it to a CSV file:

VM Name, DataStore Location, Provisioned Space (in GBs, but without the letters "GB" in the report), Power State, Primary Contact, and Classification (this is a custom attribute that we have created for specifying Prod/Test/Dev/ect).

I would really appreciate any help with getting a script to pull this info!

Thanks in advance!

0 Kudos
1 Reply

This community is a treasure trove for PowerCLI scripts :smileygrin:

There is a handy Search option as well.

To get you started, here are some examples

Re: Script to pull datacenter, clusters, current power state, OS version and custom attributes of VM

Re: PCLI script for generating virtual machine inventory including custom annotations

I would also advise if you are just starting with PowerShell and PowerCLI, to have a look at some roadmaps.

There are a couple that I find handy to start learning.



Play around a bit with some of the scripts in this community.

If you hit a roadblock, feel free to ask.

Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos