In the light of the offically released Virtual Infrastructure Toolkit I decided to create a simple powershell script. I’m planning to create more powershell scripts and post them on virtualfuture.info.

The first one is a script which can remove the connected iso files from the CD drive. Some administrators do not disconnect a CD drive when the have finished use the ISO, the side effects of this behaviour are: the VM regurally polls the CD drive which creates a slight overhead and a VMotion may fail. This script can run unattended e.g. every night so even when an ISO file remains mounted it is ejected everynight. Here’s the script:

Connect-VIServer -Server myVIserver (connect to the VI server)
get-cddrive -VM * |where {$_.ISOPATH -ne $null}|set-cddrive  -nomedia

I think the script speaks for itself.

So if anyone thinks of something to script and don’t know how please leave a comment and maybe we can find a way to script it.