Many would interest for what reason one more VMware management module has been written. In the last years the VMware team did the great work and now thousands of administrators can do almost everything, having learnt the cmdlets intuitively or by reading one of the great books on the topic.
Well, it’s the truth. Seemingly, absolutely all can be done using the standard PowerCLI cmdlets set. However, what would you do in worse circumstances? Those who work in small companies, or in mid-size companies that are not truly generous to its IT infrastructure, don’t have most of what the PowerCLI cmdlets offer. Why? The cmdlets evolve following the evolution of the flagship products. Many operations are now considered as infrastructure-level, thus they are gone on a host level. As a result of the evolution, owners of hardware running ESXi 4+ can’t automate the overwhelming majority of the lab-upbringing duties.
And here appears the ESXiMgmt module. What is it? This is a combination of a PowerShell module, the plink.exe utility and the underlying original PowerCLI cmdlets.
How does it work? As you may know, most of or even all the available operations with the host itself and the hosted virtual machines are being done via Linux utilities. Something like that there are the vimcmd utilities set somewhere in the ESXi file system, and a number of APIs for a number of programming languages and frameworks that simply leverage these utilities.
As a matter of fact, the ESXiMgmt module does the same. Cmdlets have names similar to those given to parental PowerCLI cmdlets. By calling them with parameters, you call the Invoke-ESXiCommand cmdlet. This forms parameters for plink.exe from the parameters the cmdlet given and runs plink.exe with parameters. Plink.exe in turn runs the given parameters that call the ESXi vimcmd utilities.
Disclaimer: the ESXiMgmt module contains exactly what I needed in the time I projected, built and run the lab (and built a new lab again with other parameters, and incremented the existing lab). There wasn’t the goal to copycat all the PowerCLI cmdlets offer.
At a time of its first public release (i.e., now) the ESXiMgmt module consists of the following advanced functions:
1) connection and disconnection
2) creation a folder in the file system and copying files to the file system from a local drive
New-ESXiFSDirectory, for the second goal the original Copy-DataStoreItem is used.
3) registration of a new virtual machine
4) start, stop and suspend of a virtual machine
5) getting machine Id by its name and getting machine name by its hostname
6) execution of a custom command
7) generation of dozens of virtual machines using one as a template
To start using the module all that you need to do is 1) download it 2) unpack in the module directory or in a directory of your choice 2.1) in the latter case type the path to unpacked module folder in the smaples 3) run samples. To generate new machines you need to wait a couple of days until I publish more information.