Meta

Month: January 2009

0. Installing
Installing or upgrading the VI Toolkit 1.5 is as easy as Next, Next, Finish. And using the new VI Toolkit shortcut on your desktop allows quick and easy access to the Toolkit. But what about running these cmdlets from your scripts or integrating it with other snapins? Read on!

1. Setting up your profile
The new desktop shortcut does two things for you: it starts powershell with the VI Toolkit snapin loaded and it runs a script which modified the look of the Powershell window ánd adds some cool extra functions. If you want to have the same functionality in your normal Powershell window and your scripts, you have to copy some stuff to your Powershell profile. First, set up your profile:

a. Start a normal Powershell window.
b. Run the following command: Test-Path $profile
c. Did it return True? Then you already have a profile file. Did it return False, do step d.
d. Create a profile file by running: New-Item $profile -ItemType File

2. Adding the snap-in
a. Open your profile by running: Invoke-Item $profile
b. Add the following line to the profile file to load the snap-in: Add-PSSnapIn VMware.VimAutomation.Core -ErrorAction SilentlyContinue

This Powershell script generates an overview of any items that are not available to every ESX server in a VMware cluster. These items might prevent your vm’s being vmotioned by DRS or restarted by HA. Pretty serious business, I’d say!

I showed you before how to compare the datastores for two ESX Servers using the VI Toolkit. But ideally, one would like to compare all ESX servers in a cluster to ensure VMotion and HA compatibility.
So I started scripting and it turns out to be pretty simple: only 4 lines of code in Powershell! It does the comparison for all your clusters and returns clean little tables with datastores you should investigate.

The attached script generates a csv-file with all Virtual Machines’ Disks, in which Datastore they are stored, the LUN IDs of the extents that make up this Datastore (in HEX) and the Vendor of the SAN those LUNs are on (just in case you have multiple). Simpy a great way to determine which LUNs are used by which virtual server(s) in a complex environment.

By the way: the script is filled with comments to allow you to learn how it works.

One of the challenges in managing a large VMware Infrastructure is keeping all ESX Servers within a cluster equal. This is essential for having vmotion capabilities and therefore essential for a solid HA configuration. I have showed you earlier how to add the LUN Count for each ESX Server to your VI Client. This allows you to spot differences quickly. But finding exactly which datastores are missing on which ESX Server can be a bigger challenge.

Here are some small functions that can help you determine where the major differences are.

I have showed you before how to access the License Manager with the PowershellVMwareVI Toolkit. But the properties of the License Manager appear to only reflect the Virtual Center License Information. So how do we get information about licensing for each individual ESX Server?
We need to take a look at the methods of the License Manager.
First, we connect to the License Manager: