A. Mikkelsen

VMware ESX scripts, commands, tools and other nice to know things that will make your virtualization days easier!!!!

Browsing Posts in Virtual Center

Today I needed to create a list of all users connected to a vCenter sever through the Client.
And during so I created a few variants :-)

This creates a list of all usernames connected to the vCenter server through a vCenter Client.

$svcRef = new-object VMware.Vim.ManagedObjectReference
$svcRef.Type = "ServiceInstance"
$svcRef.Value = "ServiceInstance"
$serviceInstance = get-view $svcRef
$sessMgr = get-view $serviceInstance.Content.sessionManager
foreach ($sess in $sessMgr.SessionList){
   write "$($sess.UserName)"
}

If you want to see a witch clients have been idle for 60 minutes try this.

$svcRef = new-object VMware.Vim.ManagedObjectReference
$svcRef.Type = "ServiceInstance"
$svcRef.Value = "ServiceInstance"
$serviceInstance = get-view $svcRef
$sessMgr = get-view $serviceInstance.Content.sessionManager
foreach ($sess in $sessMgr.SessionList){
    if (($sess.LastActiveTime).addminutes(60) -lt (Get-Date)){
        write "$($sess.UserName)"
      }
}

If you the want to terminate the sessions that have been inactive  for more than 60 minute

$svcRef = new-object VMware.Vim.ManagedObjectReference
$svcRef.Type = "ServiceInstance"
$svcRef.Value = "ServiceInstance"
$serviceInstance = get-view $svcRef
$sessMgr = get-view $serviceInstance.Content.sessionManager
$oldSessions = @()
foreach ($sess in $sessMgr.SessionList){
    if (($sess.LastActiveTime).addminutes(60) -lt (Get-Date)){
        $oldSessions += $sess.Key
      }
}
$sessMgr.TerminateSession($oldSessions)

You can modify the hell out of this script to suit your needs and be my guest….

You can download the full script here.

The scripts are based on code found  at the PowerCLI community by LucD.
http://communities.vmware.com/message/914858#914858

Many admins have upgraded to Windows 7 and gotten into problems when trying to install the vSphere Client.

I have found a few guides to do a workaround, but the best guide is found at techhead.co.uk.
http://www.techhead.co.uk/running-vmware-vsphere-client-on-windows-7

Thanks to Kiwi Si.

Last week I upgraded a Virtual Center server from Win2003 & MSSQL 2000 (32-bit) to Win2008 & MSSQL 2005 (64-bit).

During the installation of vCenter it asked for a 32-bit ODBC even though all the new systems was running 64-bit.
After a some time on Google i found that Windows 64-bit also includes a 32-bit version of the ODBC.

To set up a 32-bit DSN launch the 32-bit version of the Data Source Administrator. It is located at:
%systemdrive%\Windows\SysWoW64\Odbcad32.exe

Also se
http://www.vmwarewolf.com/32-bit-odbc-dsn-for-vsphere/

Today when I needed to upgrade my VC database from MSSQL2000 to MSSQL 2005 i came upon these quick guides.

http://blog.core-it.com.au/?p=27

http://spininfo.homelinux.com/news/VirtualCenter/2008/01/06/Howto_Move_Migrate_Design_VC_DB_from_SQL2000_to_SQL2005__

Howto add webages in vCenter

No comments

If you want to add a website tab to your vCenter, then here is a quick way to do it.

http://www.ntpro.nl/blog/archives/1270-vSphere-Plugin-Wizard-Released.html

Thanks to Ricky over at virtualizeplanet.com

VMware have released a demo on YouTube that shows a “must have” for PowerShell users who automate and manage vSphere and vCenter through PowerShell.

The project is named “Onyx” and works like a middelware between the vCenter Client and the vCenter Server.
Onyx is unfortunately still in a private beta and therefore not acceble to the Public…….. :-(

Read more on rtfm-ed.co.uk.
http://www.rtfm-ed.co.uk/?p=1643

Or read more on the “get-scripting podcast” blog
http://get-scripting.blogspot.com/2009/08/get-scripting-podcast-episode-12-carter.html

Read this post before upgrading.

Techtarget.com has released their Top 10 pick from VMware to tryout in 2009.
Read it.

VMware have included the old and trustworthy performance monitor VMKUSAGE in VC 2.5 U4.
This time the monotor has been added to VC as a plugin.

To get access to the new plugin you have to follow this knowledge base article.

If you like me upgraded your VC without stopping the Webaccess service first you have to follow this KB article before the plugin will work.


See more screenshots at www.run-virtual.com.

To night I had problems with uninstalling VMware Tools in a VM after updating to the latest ESX release.

The uninstaller kept asking me to insert the “VMWare Tools” disk and click OK”.
In the popup window there is pull-down field labeled “Use Source” and in this field is the number one (“1″).

If I tried to browse to the the “VMware Tools.msi” it returns an error: “The file ‘X:\VMware Tools.msi’ is not a valid installation package for the product VMware Tools…”

The solution I used to get around this problem was simply:

  1. Open the registry
  2. Locate “[HKEY_CURRENT_USER\Software\Microsoft\Installer\Products\8E24D35BB278E034284D0860A513CF1E” and delete it.
    (If you don’t want to delete it, just rename it or make a backup first)
  3. Run the VMware Tools installation again.

And wola it nor works :-)

After we have allowed Windows 2008 Servers in our VMware VI enviroment, we been having problems sysprepping Windows 2008 Server.
So here is a quick guide to sysprep a Windows 2008 server in a VMware VI enviroment.
(Use this workaround until VMware VI allows you run sysprep against a WIN2008 Server)

  1. Change the source or templates Guest Operating Systemsetting to “Vista (32 bit)” or “Vista (64 bit)” depending on the installation of the Windows 2008 server installation.
  2. Clone the VM or template and you are now able to customize your Win2008 server with sysprep.
  3. After the cloning is done Power On the new VM and let the customization complete.
  4. Shutdown the VM and change the Guest Operating Systemsetting back to “Windows Server 2008 (32/64 bit)”

The reason the above workaround works is that Vista and Server 2008 has sysprep build into the OS and the sysprep in both OS’s and are based on the same technology.

Read more here

http://www.vmwareinfo.com/2008/05/sysprep-windows-2008-in-vmware.html

http://communities.vmware.com/message/934733#934733

http://technet.microsoft.com/en-us/library/cc766514.aspx

The past few days I have been trying to learn the basic of PowerShell and the VIToolkit for Windows.
And after playing around with it, I thought that the best way to learn PowerShell was to have a goal.

And what better goal than converting the vcinfo script I created with VIPerlToolkit.

A beta version of the script is now avaiable for download – get it here.
But I have to warn you – the script is still in beta.

I have added a few of the old information and some new ones.
More info will be added when I get the time.

If you have any suggestions on what info the script should show in VC, please let me know.

I was surfing around for new powershell scripts and came across an application for icomasoft that gives you the abbility to add and run your own PS scripts from Virtual Center.

Thyis is just too cool.
Check it out.

This isn’t new!
But what is new, is that it’s now possible to run VM’s inside the hosts.

The performance isn’t the best, but it’s OK for testing.

Read the full article here.

Today I came a cross 2 possible solutions for upgrading the VMware Tools for Linux guests.

One soultion is using a custom scripts in the guest to upgrade the tools.

The second solution describes how to use Virtual Center to upgrade the tools.

The article also describes some of the advanced options parameters you can use to control the tool upgrade.

Read the entire article here.

www.vinternals.com has release a super cool looking tool (appliance) for automating the configuration of multi hosts.
The appliance is called statelesx (pronounced “stateless”).

Get more details on this super cool appliance at www.vinternals.com.

Dominic Rivera has documented a undocumented feature of VirtualCenter.

A very useful, yet very undocumented feature of the Virtual Infrastructure Client is that it can be configured to automatically pass your Active Directory credentials without you typing them in. To use: create a shortcut to the Virtual Infrastructure Client, then right-click on it and edit the shortcut properties. You’ll need to pass the program two arguments when calling it like so:

“C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe” -passthroughAuth -s vc.yourdomain.com

Where “vc.yourdomain.com” is replaced with the DNS name for your VirtualCenter server. It’s extremely simple and just might hold of carpel tunnel syndrome for an extra few days.

Today i came accross this guide on howto move the Virtual Center database from one MSSQL server to another.

Read the full guide here..

I know that this guide will be usefull when i next week have to do just that.

Read my local copy here

Ever wanted to see how many DRS VMotion your ESX enviroment is generating?

Using the following query you can extract the requried information from the VC database.

SELECT vpx_event.event_type, vpx_event.vm_name, vpx_event.create_time
from vpx_event where event_type like ‘%migrate%’

(Thanks to: Dave.Mishchenko

http://communities.vmware.com/message/969563)

Also see http://www.gabesvirtualworld.com/?p=69 for an idear to what you can do with the information in Excel.

Eric Siebert has writen a very good and explaining guide on how to troubleshoot snapshots on ESX 3.x.

Virtualization administrators can use snapshots on VMware ESX to travel back in time and figure out what went wrong with their virtual machines (VMs). But what do you do when your snapshots start acting funny? In this tip, we’ll troubleshoot potential problems that may come up when using snapshots on ESX.

Read it here or read my local copy.

Powered by WordPress Web Design by SRS Solutions © 2010 A. Mikkelsen Design by SRS Solutions