build-vmHostImage v0.2

The script has been modified to exclude certain vibs. The reason is that with some configurations we found out that the wrong vib was loaded on a vspherer host. Resulting in a PSOD, due to driver, hardware, ESXi version conflicts.

With this in mind, I added the functionality to exclude VIBs. The excluded VIBs are listed in the parameters.ps1 file.
After the new image profile has been configured, the script will exclude the VIBs, if they are present. VIBs that are excluded are reported in excluded.txt file.

The script creates a parameters.ps1 file in the project folder, containing the names of the Vibs that are excluded. This file is used to re-create an image if necessary.

You can find the script at github, here

Loading PowerCLI one-line

Finaly 🙂
You can load PowerCLI with a one-liner again.
Why ? well… PowerCLI 6.5 is only moduled based, while the previous versions where a mix off snappins and modules.
When it was mainly snappin bassed I used a one-liner like:

get-pssnapin -registered vmware* | add-pssnappin

When PowerCLI was module and snappin based, I used a custom PowerShell function import-PowerCLI (see my previous post for details). But with PowerCLI 6.5 R1 you can use a one-line once again.
This one-line is :

> Get-Module -ListAvailable vmware* |Import-Module

Powershell script template

To make live a bit easier when writing powershell scripts, it is a good idea to have some kind of a script template.

Why ?

By using a template you don’t have to worry about the standard stuff you always put in a script. And you can also have some customs functions already available. It is a good starting point for writing the script you want.
And it helps you to standardize you scripting. Which makes it in the end easier to maintain etc… Continue reading “Powershell script template”


For my work I use PowerCLI a lot, but I don’t like the shell that is available when installing PowerCLI. I just want to start PowerShell (mostly through PowerShell ISE) and load with one command the PowerCLI modules and/or snapins and not be limited.

Before PowerCLI 6.5, PowerCLI was a mix of powershell snappins and modules. To support older PowerCLI versions, the script will check if there are vmware powershell snappins registered. And will load them.
Powershell modules will have precedence over the snappins. Continue reading “import-PowerCLI”