It’s been quite a while it started to tease us, and here it is, LazyVMAdmin !
You may be like us and need to manage multiple vCenter (and therefore also multiple PowerCLI connections), and you’re in a structure where your workstation’s login is different from the one you use to connect your console (typical use of an elevated account).
In our case, it was becoming critical, and as we say, “a good admin is a lazy one”, we asked ourselves the question of how to avoid the need to re-authenticate each time you start vCenter console and/or PowerCLI.
We went through the credential stored in .db files or abusive use of the runas tool, etc. .. in short, nothing sexy.
Finally, we said that if you want something done, do it yourself, so we decided to make our own tool named LazyVMAdmin (a big thanks to RB for his more than necessary help to make something not too dirty: p).
Well, LazyVMAdmin, what is it?
This tool will load in Windows systray and will allow :
- Store in a secure way credentials supplied by user
- Launch application using this credentials security context
Basically, it will allow you to quickly launch applications without having to reauthenticate (runas behavior-like).
For instance with the vSphere client, you can check the “Use Windows session credentials” box in order to use SSO :
This projet was developped in C# (Framework 4.0), sources are available for Visual Studio 2010 and the documentation generated with SandCastle (available on http://shfb.codeplex.com/).
In the project, there is the following files :
- AboutForm.cs : Information form on project
- ActiveDirectory.cs : Active Directory managing class
- app.config : Configuration file for the application
- AuthForm.cs : Authentication form
- MainForm.cs : Main form with systray management
- ProcessManager.cs : Process managing class
- Program.cs : Main class for application launch
- SecureStringHandler.cs : Secure String (used for password storing) managing class
An important file is the .config provided with application.
This file contains the configuration used by the application and is mandatory (there will be an error if the .config isn’t at the same root than the .exe file).
Here is an excerpt of the .config file that you can modify in order to put your own parameters :
<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=184.108.40.206, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <section name="LazyVMAdmin.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> </sectionGroup> </configSections> <userSettings> <LazyVMAdmin.Properties.Settings> <setting name="CommandShellFileName" serializeAs="String"> <value>cmd.exe</value> </setting> <setting name="CommandShellArgs" serializeAs="String"> <value /> </setting> <setting name="vSphereClientFileName" serializeAs="String"> <value>C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe</value> </setting> <setting name="vSphereClientArgs" serializeAs="String"> <value /> </setting> <setting name="powerCLIFileName" serializeAs="String"> <value>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</value> </setting> <setting name="powerCLIArgs" serializeAs="String"> <value>-psc "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -noe -c ". \"C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1\""</value> </setting> <setting name="DefaultUsername" serializeAs="String"> <value>username</value> </setting> <setting name="DefaultDomain" serializeAs="String"> <value>domainname</value> </setting> </LazyVMAdmin.Properties.Settings> </userSettings> </configuration>
And here is definition of these parameters :
- CommandShellFileName : File path for cmd.exe (if not in %PATH%)
- CommandShellArgs : Parameters for cmd.exe
- vSphereClientFileName : File path for VpxClient.exe (if not in %PATH%)
- vSphereClientArgs : Parameters for VpxClient.exe
- powerCLIFileName : File path for powershell.exe (if not in %PATH%)
- powerCLIArgs : Parameters for powershell.exe
- DefaultUsername : Default user name that will be auto-fill in authentication form
- DefaultDomain : Default user domain name
Here it is for download :