top of page

Window into VMWare's Soul

Sep 26, 2016
1 min read

So buying into the brave new world of PowerShell? Using VMWare as your hypervisor? Would love to query your vSphere server from the command line, saving time and energy on copying out information and or web portal page loads?

Then look no further - PowerCLI from VMWare is what you need. VMWare PowerCLI is not a poweshell module to load into PowerShell but is a separate program much like PowerShell Exchange. You can download the latest PowerCLI from VMWare here : http://www.vmware.com/go/powercli

Once you have installed the program, run VMware vSphere PowerCLI.

You will need to connect to your vSphere server so :

Connect-VIServer -Server <vCenterIPAddress> -User <adminUsername> -Password <password>

If you have more than one VMWare deployment you can repeat the above for each vSphere client to link them all to your current session. Allowing you to run reports on all the vm's across all deployments at once. Handy for our environment but your mileage may vary.

To get a list of all VM's try a simple :

Get-VM

To export a list of all vm's including folders, ram, disk usage etc etc, to Excel then first you need to import the Excel module :

Install-Module importexcel

Why install excel rather than just export to native csv? Well with the module installed you can do more than just export tables - you can have excel generate graphs from the data as part of the export as well! Anyway that is for another day. So now you can do something like :

get-vm | export-excel C:\data.xlsx

Have fun and remember - its a brave new world!

-DeadKaptain


 
 
 

Comments


About

The musing, thoughts and titbits of DeadKaptain. Not just Geeky, Technical and Whimsical but also articles of interest, projects ongoing through to complete and a link to all social media, forums and groups DeadKaptain participates in.

​

Feel free to contact DeadKaptain through your preferred medium for rant, questions or just old fashioned banter.

​

And why DeadKaptain? Well if you weren't there you just wont get it.                                                                                                                                 - DeadKaptain

bottom of page