Wednesday, July 18, 2012

Powershell and VMware: "Get the list of all Virtual machines on VMware VSphere Server using PowerCLI.



In my first post about "Getting Started with VMware Vshpere PowerCLI" i already showed how to connect with VMware server.

Our today's task is simple. you get the list of all Virtual machines, and then we search for all "Powered ON" machines and after that all "Power off" machines.

Nothing complicated here. this is just a simple task and again the basic usage of Powershell is applies here. and we have some good "best friend " cmdlets those always with us. these cmdlets are "where-Object", "Select-Object".

Let's Start

Connect to your VMware server first using Connect-VIServer cmdlet. Once you successfully connected.

Run the Get-VM cmdlet.

That will show you the list of all Virtual machines including their "Power State"

18-07-2012 13-01-59 

If you want to see all the properties of Virtual Machines, run the below cmdlet.

Get-VM | Format-List *

Now you can see that we have detailed information about virtual machines.

18-07-2012 13-06-21 

And in case you want to know about a single Virtual Machine , use Get-Vm  and -Name of the machine and then Piped it to fl *

Get-Vm -Name "Dummy-Windows7" | fl * 

18-07-2012 13-18-05 

As i mentioned in the starting that our original target is to find the list of all Up and Running Virtual machines. To achieve that we can use Where-Object and show that Virtual machines whose status is equal to "Powered ON".

Get-vm | where { $_.PowerState -eq "PoweredOn"}

18-07-2012 13-20-08 

Finally i got he list of all "Power ON " server and  i am happy now :)


Thanks for reading.


Aman Dhally

Buy-More-Twitter-Followers 4fb29548b6adc  linkedin


  1. Your posts is really helpful for me.Thanks for your wonderful post. I am very happy to read your post. It is really very helpful for us and I have gathered some important information from this blog.

    Salesforce Training


  2. I am following your blog from the beginning, it was so distinct & I had a chance to collect conglomeration of information that helps me a lot to improvise myself. I hope this will help many readers who are in need of this vital piece of information. Thanks for sharing & keep your blog updated.
    Salesforce training in Chennai|Fita Chennai Reviews

  3. Your blog is really awesome and I got some useful information from your blog. This is really useful for me. Thanks for sharing such a informative blog. Keep posting.

    Cloud Training in Chennai

  4. There are lots of information about latest technology and how to get trained in them, like Hadoop Training Chennai have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies(Hadoop Training in Chennai). By the way you are running a great blog. Thanks for sharing this.


  5. Great thoughts you got there, believe I may possibly try just some of it throughout my daily life.

    Modular Workstations Chennai

  6. Nowadays, most of the businesses rely on cloud based CRM tool to power their business process. They want to access the business from anywhere and anytime. In such scenarios, salesforce CRM will ensure massive advantage to the business owners.
    Salesforce Administrator 201 Training in Chennai|Salesforce Administrator 211 Training in Chennai|Salesforce Training in Chennai

  7. Great thoughts you got there, believe I may possibly try just some of it throughout my daily life.
    qtp training in chennai

  8. Your posts is really helpful for me.Thanks for your wonderful post.
    manual testing training in chennai


  9. Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write.I like the post

    Modular Workstations Chennai

  10. Thanks for providing this informative information you may also refer.