Tag Archives: Script

How to properly initialize PowerCLI 6.x in PowerShell ISE

With the release of vSphere 6.0 VMware has started to transform their distribution model of PowerCLI cmdlets from PSSnapins into modules. This is a good thing because modules are the preferred method of adding cmdlets to PowerShell. Unfortunately the changed behavior breaks plenty instructions on how to load VMware PowerCLI in ISE, including my own. The old method works for core cmdlets, but functions related to Distributed Switches or Storage Policies for example are missing.

If you have the latest version of PowerCLI installed but cmdlets are missing in PowerShell ISE, maybe you are using the old method to load cmdlets.

Get-VDSwitch : The term ‘Get-VDSwitch’ is not recognized as the name of a cmdlet, function, script file, or operable program.

Read more »

Product End Of Support Matrix now available as JSON (incl. Script)

The database used at my VMware Product End Of Support Countdown is now available in JSON. The database is based on VMware Lifecycle Product Matrix and allows you to use the information in scripts or for automation purposes.


I’ve also written a small script to demonstrate what this information can be used for.

Read more »

Script to add vSphere 6 VMCA Root Certificate to Trusted Certs Store

When running vSphere 6 deployments in default (recommended) mode, VMware Certificate Authority is its own root certificate authority. Everything fine and secure with this configuration, but your browser displays a warning because the root certificate is not trusted.

I’ve written a little script (VBS) that pulls the CA certificate from a vCenter Server and adds it to the local trusted root certificates store. When the root CA is trusted, browser warnings are gone.

Read more »

How to Create a Cron Job on vMA

The vMA (vSphere Management Assistant) is a virtual appliance provided by VMware that allows to manage vCenter Server or ESX Hosts and run scripts. You can also use it to run script periodically with cron. It is a small linux appliance delivered with all necessary tools out of the box. I usually deploy a vMA on each platform. This post describes how to prepare scripts to be used with cron and how to create cronjobs. The process is very similar on all vMA versions from vSphere 4.0 to vSphere 5.5.

Read more »

ESXi 5.5 Performance Metrics

Shot post on performance metrics to be used for performance analysis with esxcfg-perf.pl for example.

Read more »

HP Proliant Gen8 Agentless Management floods ESXi and vCenter Logs

Hewlett-Packard introduced a new component called HP Agentless Management within their Gen8 Series. This feature is extensible though an agent running inside the operating system, in that case the ESXi Host. The package (hp-ams) is included in all customized VMware images provided by HP and the HP ESXi Offline Bundles. Unfortunately this package create some issues caused by excessive local logins. This might pointlessly blow up the database and logfiles. You can check that problem by opening the Event-Log provided by the ESXi Host which is flooded with the following messages:

User root@ logged in as
User root@ logged out (login time: , number of API invocations: , user agent: )
User root@ logged in as
User root@ logged out (login time: , number of API invocations: , user agent: )


In this post i am going to show how to workaround this issue and remove the hp-ams from you ESXi Host, and how to build a new image without that package.

Read more »

Run Scripts in Linux Guests by using VMware Tools

Running commands inside a virtual machine without accessing it can be helpful in some cases. For example when you want to change an IP address from a Linux virtual machine that is not reachable through ssh. VMware provides the VIX (Virtual Infrastructure eXtension) API that helps you to write scripts to automate virtual machine operations and run programs within guest operating systems. I am going to show some basic VIX implementations using PowerCLI.

Read more »

ESXi 5.1 – ESXCLI Command Mindmap

With vSphere 5.1 the command line interface esxcli has introduced many new features. The esxcli is a complete set of commands that you can use to automate you environment or to perform advanced tasks like lun masking. I have created and printed a mindmap to navigate through the namespaces more quickly

ESXCLI has 10 namespaces whose names are self-explaining: Read more »

Migrate E1000 Adapter to vmxnet3 with Linux Virtual Machines

When you select Debian or Ubuntu as Operating System during the creation of virtual machines the wizard automatically selects E1000 as virtual network adapter. To get better network performance it is a best practice to change this to vmxnet3. But what if the virtual machine is already installed and running? The Adapter Type is grayed out, even when the virtual machine is powered off. How to change the Adapter Type later? Read more »

Nagios Check: VMware Virtual Machine Snapshot Age

As you might know it is a VMware best practice to keep snapshots for more than 24-72 hours. To monitor aged snapshots using Nagios i created a perl script that checks the whole vCenter for snapshots. The script throws a warning because i think this is still not a critical event. You can easily change the behavior by changing the exit code to 2.

I set the allowed age to 3 days, based on VMware  KB1025279. You can change the maximum allowed age to whatever you want by changing the subroutine check_age.

You can use this script as source for Nagios. There is also a multiple line output which allows you to see the virtual machine that caused the warning event. Read more »