Ying Li at myITforum.com

PowerShell & System Center

Introducing VMWare Infrastructur Toolkit (for Windows) 1.0

Recently VMWare released their version of PowerShell Cmdlets called VI ToolKit. You can download it Here and it is free!

VMWare is also challenging the world's VI administrators for a scripting contest, you can win a trip to VMworld 2008 Las Vegas or $5000 cash. Sounds too good to be true - it is not!

But before we get too excited, we have to setup a good foundation - At least we need to get it installed before we can write anything!

The installation itself is very straight forward process but it requires PowerShell v1.0 and it won't work with PowerShell CTP 2.0.

Some cmdlets only supported in API version 2.5 or newer.

After the setup you can start the Toolkit from start - all programs - VMware - VMWare VI Toolkit - VMWare VI Toolkit (for Windows) or

If you like me, "hate" to open one powershell console for each application, you can open the regular powershell console and run:

Add-PSSnapin VMWare.VImAutomation.Core and then run Initialize-VIToolkitEnvironment.ps1 in C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\Scripts

Now you regular powershell console becomes VMWare VI Toolkit!

By now we have everything in order, we can put VMWare VI Toolkit in action.

you can go get-VC or Get-ESX to connect to your virtual center or ESX host

after you connect to your VC or ESX, you can do

get-vm |select name, powerstate

You will get something like:

MOSS-SQLS01
PoweredOn

SCCMS01
PoweredOn

MOSS-SPRS01
PoweredOn

VEMS01
PoweredOn

Clone-ANSS01
PoweredOff

Clone-APPS01
PoweredOff

Clone-SPRS01
PoweredOff

SCCMS04
PoweredOn

...

You can do start-vm "clone-anss01" to poweron the vm box

or stop-vm "SCCMS01" to poweredoff the vm box

To get a list of VI command, type:

get-vicommand

I only played with it for a couple of hours and I like it already. It indeed feels and looks like PowerShell! From here, your imagination is your limit - I don't know about you, I started to hear the slot machine singing already. :)

Posted: Aug 11 2008, 10:26 PM by yli628 | with no comments
Filed under:

Comments

No Comments