icomasoft PowerScripter 1.5  
Purpose of PowerScripter

Dennis Zimmer, CTO of icomasoft ag is a virtualization veteran writing books and articles about virtualization and produced a videotraining for VI 3.5. As he used the VMware VI Toolkit for Windows in early beta stage the first time, he directly noticed the overwhelming possibilities for future administration of virtual infrastructures. Earlier, administrators were forced to use C# (VB .net), Java or Perl to write simple administration tasks. This used to be a challenge for many administrators, because they were lacking experience with these programming languages and not the time to learn them. As a consequence, they had to rely on plug-ins or tools written by individuals of the community without really understanding the code. Thus, they were hardly able to customize them to fit their needs.

VI Toolkit for Windows with PowerShell closes a gap, because it's very easy to script even complex tasks. Actually, PowerShell scripting language is absolutely easy to learn and the VMware CmdLet changes so many queries or actions from multiple lines of complex code to a simple command like Connect-VIServer (connecting to an ESX or VirtualCenter host) or Get-Datastore (List of all existing datastores reachable by the connected ESX or VirtualCenter server with common informations). Now you can easily understand, create, customize and run your own scripts whenever you need them, without having to rely on programmers.

However, PowerShell scripts are external commands for VMware, meaning that you have to search for your objects outside of VI Client before running the commands. If you have an unknown or changing infrastructure you would have to change the scripts accordingly to map the new or changed environment. Not so when using icomasoft© PowerScripter scripts!

For example - you want to do a Rescan SAN/Refresh on all VMware ESX hosts within the Cluster Group "HQ1":

Connect-VIServer -server "VirtualCenter" -user "admin" -pass "vmware"
foreach ($esxhost in (Get-Cluster "HQ1" | Get-VMHost))
{
$esxhost | Get-VMHostStorage -RescanAllHBA
$esxhost | Get-VMHostStorage -Refresh
}

Per se, that is pretty easy to do. But if the cluster name changed, you'd have to change the script accordingly. And you couldn't let the support team run the script, because of the connection credentials within the script ... it would most probably breach your company´s security compliance rules and, certainly your own principals.  Moreover, it´s hard to build scripts to configure only a fraction of hosts or virtual machine - let´s say you just want to configure 3 of 10 virtual machines running on a host. If you wanted to do so, you´d have got to create an input- or listbox for questioning the users which virtual machines should be affected by the script.

We thought it could be even easier and more straightforward to use the PowerShell within the VMware Infrastructure, so we created the icomasoft© PowerScripter. As our software is a plug-in within VI Client, we already own the rights and credentials (session) of the logged in user - all access rights given within the permissions tab are in effect. Moreover, because icomasoft© PowerScripter knows the correct object at all times, you can just right click (context menu) on the object (DataCenter, Cluster, Host, Resource Group, VM) within VI Client you want to run the script against.

Such a script needed for PowerScripter (HostScripts Folder) would look like this:

RescanSAN.ps1:

$_ | Get-VMHostStorage -RescanAllHBA
$_ | Get-VMHostStorage -Refresh

You don´t need an authentication (because you´re already logged-in through VI Client) and the script runs automatically against all hosts within the chosen object. Thanks to icomasoft© PowerScripter you can access the actual Host object with $_ . Since not all scripts can run that way, we implemented some switches for control output or script behaviour.

icomasoft© PowerScripter uses dynamic context menu entries within VI Client, which are updated every time our PowerScripter plugin loads. So you can write your PowerShell scripts or take existing ones and load them into the target folders (VmScripts or HostScripts). After refreshing the context menu, all your scripts have their own menu entry and you can run them against the chosen virtual infrastructure objects. If you already have PowerGUI script packages called PowerPacks, you can also integrate them just by applying minor changes as shown in the script example above. We believe there is no easier way to administrate your VMware infrastructure.

Please note that the use of PowerShell scripts is not limited to the PowerShell CmdLets for VMware; you can also configure Active Directory, Microsoft Operations Manager, Microsoft Exchange or simply do WMI queries to Windows Hosts and Guest. There are also CmdLets for SSH (http://www.nsoftware.com/PowerShell/netcmdlets/v2.aspx). Alternatively, you may use Plink (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) for running SSH commands against servers. So, icomasoft© PowerScripter is not limited VMware. Imagine using a script configuring all your IP Adresses within the chosen virtual machines to a new range you defined (in case of Failover to a second location), or triggering an alert at Operations Manager because of high Temperature within ESX health status!

You can now create simple or complex tasks and workflows for your Infrastructure for extending VMware ESX or VirtualCenter functionality on your own. And best of all, its customizable to your company requirments!


 
Copyright © 2009 icomasoft ag, Switzerland