Hello PowerCLI

 

So today is the first time I am trying out PowerCLI for vSphere. Yes, I know I am late to the game in the VMware scene, but I hope to start learning more about PowerCLI and start automating some tasks that are currently being done manually where I work.

 

Here is my first try at connecting to my lab vCenter server 🙂

 

Pretty simple really, just as the banner text says, use:
Connect-VIServer servername and
Get-VM

to connect and get a list of VMs. I guess this is my “Hello World” start out with PowerCLI then. If anyone has any tips or quick and easy cmdlets to run in PowerCLI to get information back, please drop a comment with them below. I would also love to know how to iterate through a list of VMs and check whether they have snapshots or not! That would be a great start to what I am looking to achieve.

Cheers!

7 thoughts on “Hello PowerCLI”

  1. Paul, not sure if you noticed, but I did a follow up post describing the process and showing off the script to check for snapshots on VMs in your infrastructure. Check out this post for the script: http://www.shogan.co.uk/?p=686 – (just have a look at the part of the script that sends the e-mail for how to do that bit) hope that helps!

  2. Hi Paul,

    No problem – I don’t have it at work with me at the moment – its on my home lab system, so as soon as I get home I’ll post it up here so that you can grab the e-mail part of it. It should just be a simple case of trading the cmdlets that retrieve the snapshot VMs with the Get-VM cmdlet.

    Check back later this evening / tomorrow and I should have it up for you.

    Cheers,
    Sean

  3. @Sean

    Hi Hugo,
    I am getting into this PowerCLI lark as well. Any chance you could share your your email script? I’m trying to get a list of vms across our 6 vCenter servers in one shot and then emailed to some managers. Having problems so what you’ve done may help.
    Thanks
    Paul

  4. Hey Hugo,

    Awesome stuff – I am booking marking your site now. In the mean time I have figured out how to do my VM snapshot checks and also made a cool styled HTML table for it at the same time, along with using some generic powershell script to email the results to me, so I guess I am off to a decent start. I’ll be checking your site out later today to see what you have there. Thanks for letting me know!

    Sean

Leave a Comment