Ever had a problem to solve but not sure how to proceed? This little function might help you out, it searches through all available PowerShell commands looking for a keyword you specify, and will search the full help text, including the examples.
For example, let’s say that in PowerCLI you’re trying to set up or diagnose VMotion, but not sure what cmdlets might help. All you’ve got to do is load this function, then run Search-Help vmotion, which will return this list.
CommandType Name Definition
———– —- ———-
Cmdlet Move-VM Move-VM [[-VM] <VirtualMachi…
Cmdlet New-Cluster New-Cluster [-Name] <String>…
Cmdlet New-VMHostNetworkAdapter New-VMHostNetworkAdapter [[-...
Cmdlet Set-Cluster Set-Cluster [[-Cluster] <Clu…
Cmdlet Set-VMHost Set-VMHost [[-State] <Nullab…
Cmdlet Set-VMHostNetworkAdapter Set-VMHostNetworkAdapter -Ph…
You can then run help on any of the results to drill down further.
PowerCLI is becoming a basic weapon in the vSphere administrator’s arsenal. At the same time, PowerCLI has been described as magic or a "dark art". But it doesn’t have to be this way! As with anything, there’s a few tricks you need to know before things start making sense. If you’ve been considering diving into PowerCLI but are worried about how much time you’ll have to invest, you should attend my VMworld session, VM2241 — Managing vSphere With PowerCLI, which will take place on September 1st at noon.
Just a few of the things you can expect to get out of this session include:
- What PowerCLI is and why you need to know it.
- The top 5 things you need to know to become a PowerCLI master.
- A preview of upcoming PowerCLI attractions. (The roadmap, for those of you who love buzzwords.)
Presenting with me will be none other than The Right Honorable Reverend Mr. Scott M. Herold Esquire, who very humbly refers to himself as VMGuru. Now how much would you pay? But wait! We will even have Yavor Boychev from our development team showing off a really cool and top-secret new tool!
So I know you’re already pretty excited, but wait till you read this! You may want to sit down before reading any further. There is so much great stuff to talk about with PowerCLI we didn’t want to try to squeeze it into a mere 60 minutes, instead we’ve got a jumbo 90 minute session bursting with scripty goodness.
The most important rule we’re following for this presentation is "Maximum Demo, Minimum Slideshow", so even though the session is 90 minutes long we don’t expect too many people to catch up on lost sleep. Instead, you’ll see lots of hands-on demos of the things PowerCLI can do to make a real difference in your day-to-day vSphere administration. I’ll be sending out teasers of the stuff we’ll be demoing via the PowerCLI Twitter account, be sure to follow it if you’re one of those twitter using types.
To sign up, head over to vmworld.com and add VM2241 to your schedule builder (some of you may need to wait until August 3rd to get access to the schedule builder.)
Hope to see you at VMworld!
Lately, Arne Fokkema’s blog has had a lot of great PowerCLI information and examples, such as this script for upgrading virtual hardware, which is great for anyone who is moving from ESX 3.5 to ESX 4.0. I’ve also added Arne to the blogroll, so be sure to subscribe to his blog.
Another great resource that’s come up in the past few months is vmwarescripting.com. This site covers all types of scripting related to VMware, but most of the content there focuses on PowerCLI. The most interesting stuff there focuses around reporting, where they have more than 25 scripts. Eric Sarakaitis also has a blog which looks like it could become a very good one.
The last is a wiki run by Wil van Antwerpen called vi-toolkit.com. Wil’s site covers a wide range of topics, including information on ESX console commands that you won’t find anywhere else. The wiki’s PowerShell page has lots of great information on using both PowerShell and PowerCLI, and is a great addition to your feeds. I especially like the script to determine every VM created in the past 30 days, which originally comes to us from Cody Bunch.