PowerCLI Group Discussion

VMworld PowerCLI Group Discussion–Part 1–Getting Started

imageAlways my favorite session at VMworld, the group discussion gives others a chance to share their experience and give their view on a product.

I have hosted a PowerCLI Group Discussion for the past 2 years and have found them a great way to learn and share information.

This year with some great note taking by my beautiful assistant Nigel Boulton I thought it would be useful to type up these notes from the session and share them on my blog.


The other posts in this series can be found below:

In Part 1 I will cover what we discussed around getting started with PowerShell and PowerCLI.

  1. Find a reason or a task to learn PowerCLI.  Its easier to learn PowerCLI by turning a day to day job into an automated script and having a reason to learn it than just saying I am going to learn PowerCLI today.  Find something you don’t like doing or something you do more than once and take the time to script it.  It may take more time to write the script but on day 2 you will have the script and more knowledge on PowerCLI.
  2. Reporting is a great place to start, you can get used to how PowerShell and PowerCLI works without the fear of accidentally deleting or changing something in the environment. Start with the Get- cmdlets as these are the cmdlets that just read information.
  3. Use a test environment, using a test environment you can be sure you will not break anything at large scale! If you don’t have a test environment then remember the VMware HOL are available on the internet now and can be used to play with PowerCLI in a safe environment that will be deleted when you are finished anyway.
  4. Use Get-Help, not just for the details on the cmdlets but also for the –Examples these can be copied and pasted and altered for your environment.
  5. vCheck is a great example with lots of different plugins, check out the plugins and learn from the code.
  6. Use the –WhatIf parameter when running cmdlets, EG “Get-VM VM1 | Stop-VM –WhatIf” this will give you the chance to see what would have happened if you ran a cmdlet.
  7. PLAGARISE, STEEL, BORROW! Often the scripts you need have been written, if not 100% then at least 80%. Search the blogs and PowerCLI Community before starting a script and use the information that is out there and adjust it.  The PowerCLI community is very helpful and will not mind you using the script to make your lives easier.  It is always nice to obviously add a comment saying where you borrowed the script from if you share it again.
  8. Ask for help in the PowerCLI Community, give it a go first and paste what you have, as I said the community loves to help so ask a question in the community and let them help you where you got stuck.  Don’t just say I need a script that does x, show you have tried first!
  9. There are PowerCLI Apps for the iPhone, some people use these to check out the cmdlets and learn a little more about them.
  10. Get-Command and Get-VICommand are great cmdlets to show you what exists in your session and where to start, use Get-Command *Something* to list the cmdlets with something in their name.

6 thoughts on “VMworld PowerCLI Group Discussion–Part 1–Getting Started”

Leave a Reply