I’m really excited about the VI Toolkit Extensions as a way for us to make the common problems we see on our forums really easy to do. Just today, a user wanted to find all files on his datastores that contain the word "delta" (which can indicate a snapshot that hasn’t been cleaned up properly). As it turns out, with the extensions this is just a one-liner. The art of PowerShell really seems to be the art of the one-liner and with the extensions there are already a lot of great one-liners you can use.
We’ve got more than 10 cmdlets in the extensions now, and it’s starting to get really useful. Here’s a brief tour of what we’ve got so far:
One of the really great new things in the extensions is the ability to copy files to and from datastores. None of this would have been possible without the help of Stephen Campbell of Marchview Consultants Ltd. Stephen wrote an amazing example of actually compiling C# code within a PowerShell script. With this code, Stephen was able to create a .NET-based web client that would accept self-signed certificates, which is critical for enabling file uploads to ESX hosts. With the new Copy-TkeDatastoreFile cmdlet you can do some really amazing stuff.
Here’s an example you can use to move VMs from one ESX host to another without having to rely on VirtualCenter. This example assumes that each ESX server has a datastore called datastore1 and that there’s a VM called MyVM that is to be moved.
The cmdlet can also accept arbitrary URLs as either sources or destinations. Here’s an example of copying an Openfiler virtual appliance directly to your ESX host:
If you combine that with a little more scripting it’s fairly easy to have a one-liner that can create iSCSI storage on your ESX host, something we’ll hopefully have in the extensions before too long. Neither of these examples even require a password, since they rely on connections already being established through the Connect-VIServer cmdlet.
Anyway, there’s lots of great stuff we have planned for the extensions, so be sure to stay tuned. If you’ve got a feature you want to see, ask us. To get started with the extensions you need PowerShell 2 CTP2 as well as the VI Toolkit. Have fun!