Fun with PowerShell & VMware

I’ve been playing with the new powershell kit from VMware which is currently in Beta. It’s pretty cool, and helps to address some of the common automation requests which my students and customers come up with. Such can we automate the adding of an ESX host to VirtualCenter – and can we script the changing of the port group assignment of virtual machines.

I haven’t been playing long with Powershell – a day or so. But I’m impressed enough to at some point soon put together quick “Getting Started Guide”" so you can join in the fun. For the moment here’s some links you will find REALLY useful

Firstly, if you are running VirtualCenter on Windows 2003 – you will need to download the PowerShell 1.0 package from Microsoft. There is a XP & Vista version too – but I choose to install my powershell stuff to my VirtualCenter box:

Secondly, here’s where you find the release notes on the VMware PowerShell Toolkit Beta, it is also where you will find the downloadThirdly, here’s a really handy tool from PowerGUI.org. This puts a graphical shell around the command-line such that you ask for task to happen through a graphic front-end – and it greats the powershell scripts for you. This is absolute fantasic – and means you don’t if you an admin like me need to learn directly how to type in strings of powershell code

http://www.powergui.org/downloads.jspa

Fourthly, you will also need from Quest a free extender of PowerShell that makes it easy to authenticate against an Active Directory system

http://www.quest.com/powershell/activeroles-server.aspx

Finally, another set of people have written an extension called the VMware VIT Kit.powerpack to PowerGUI that adds whole series of tasks you can carry out – again all you have to do import this powerpack to PowerGUI – to get the GUI front-end – and they do all code for you

http://powergui.org/entry!default.jspa?categoryID=21&externalID=1802

After installing these 1-2MB applications – within about 5mins I had script that change the power groups on few of my virtualmachines:

Get-VM -Server $global:VIServer | Sort-Object -property “Name” | where { ‘web-1′, ’sql-1′, ‘fs-1′, ‘dc-1′, ‘ctx-1′ -contains $_.Name} | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName vlan23

Did I have to learn all this code and syntax – no PowerGUI+

Comments are closed.