Create a vSwitch Port Overview with Powershell

WARNING: VMware vmotion does not check wether there are sufficient ports available on the virtual switch on the destination host. Migrating a vm to a host with insufficient ports will cause the vmotion to complete without warnings, yet the virtual NIC will be disconnected! This issue is descripbed in this KB article.
The solution to this problem is to create vSwitches with sufficient ports, obviously. Do you want to know how many ports are currently being used on every vSwitch in your environment? vSphere PowerCLI to the rescue! Try the following script:

Continue reading

»crosslinked«

Examine VMware CPU Ready Times with Powershell

When your (VMware) consolidation ratios are becoming high, it might be smart to keep an eye on your vm’s CPU Ready Times. Unfortunately, by default, the VI Client will only show realtime ready time statistics. Plus you’d have to look at each vm individually. Thank God VMware for the PowerCLI! Read this document for more information on how to interpret the results.

Continue reading

Managing Scheduled Tasks Remotely Using Powershell

The following Powershell functions allow you to manage querying, creating and removing scheduled tasks on one or more computers remotely.
The functions use schtasks.exe, which is included in Windows. Unlike the Win32_ScheduledJob WMI class, the schtasks.exe commandline tool will show manually created tasks, as well as script-created ones. The examples show some, but not all parameters in action. I think the parameter names are descriptive enough to figure it out, really. If not, take a look at schtasks.exe /?. One tip: try piping a list of computer names to foreach-object and into this function.

Continue reading

Increment PowerGUI Xml Version with Powershell

If you are using PowerGUI (which you should) and some of your collaegues do too, you might want to use a central configuration. Whenever you want to update the central configuration xml file, you need to increment the version number in order to push this change out to your collaegues. The following function increments the version number for you and even allows you to store the new file to the central location at the same time. All without having to edit the complex xml file manually. It even saves a backup copy of your central config file in case you mess up ;) It assumes you use a simple x.y version number, so please start out with 2.0 when setting up your config.
To update your central config: just make the modifications within PowerGUI and then run this function.

Continue reading