VMware PowerCLI Function to Modify Virtual Machine Configuration Options

I was looking for a powershell script to set a few virtual machine security options for a school lab. The configuration keys I need to set are isolation.device.connectable.disable, isolation.device.edit.disable, and RemoteDisplay.maxConnections.

I found a function used to set RemoteDisplay.maxConnections here. By changing the RemoteDisplay.maxConnections it could be used to also change the other options so I modified the function to accept another parameter for the setting you want to add or change.

Here is the function:

Function Set-ExtraOptions{
param(
    [string[]]$vmName,
    [string[]]$KeyName,
    $KeyValue
)
    $vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

    $extra = New-Object VMware.Vim.optionvalue
    $extra.Key="$KeyName"
    $extra.Value="$KeyValue"
    $vmConfigSpec.extraconfig += $extra

        $vm = Get-VM $vmName | Get-View
        $vm.ReconfigVM($vmConfigSpec)
}

And here is how you call it:

Set-ExtraOptions -vmName VM_NAME -KeyName KEY_NAME -KeyValue KEY_VALUE

To set isolation.device.connectable.disable to FALSE for LabVM-A just call the function like this:

Set-ExtraOptions -vmName “LabVM-A” -KeyName isolation.device.connectable.disable -KeyValue FALSE

February 10, 2011 | Filed Under Virtual Lab Project, Virtualization | Leave a Comment 

ESXi 4.0 to ESXi 4.1 upgrade using VUM

My ESXi upgrades from 4.0 to 4.1 using vCenter Update Manager went without issue.

The process is pretty simple and detailed instructions can be found in the VMware KB here which includes this video:

I am not going to walk through the steps, the video does a great job of that. The video shows updating from 3.5 to 4.1, the only difference in the 4.0 to 4.1 upgrade process is the upgrade bundle that is used.

I had originally planned to do half my hosts on one morning and the second half the next but the upgrade was quick, it did not take more than 10 minutes for each host, so I went ahead and updated all of them.

February 8, 2011 | Filed Under Virtualization | Leave a Comment 

VMware vCenter ADAM_VMwareVCMSDS Warning

We migrated/updated our vCenter server from 4.0 with Windows 2003 Server (32bit) on a physical box to 4.1 on a VM running Windows 2008 R2 this week and so far everything has been running smooth and without issues. I did notice that the vCheck script was reporting some warnings in the vCenter log that I had not seen before the migration.

Here is the the warning message:

Active Directory Web Services encountered an error while reading the settings for the specified Active Directory Lightweight Directory Services instance. Active Directory Web Services will retry this operation periodically. In the mean time, this instance will be ignored. Instance name: ADAM_VMwareVCMSDS

This message was being repeated once every minute.

After a bit of research I found a post in the VMware Community which lead me to the fix that is here.

The registry value for \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\ADAM_VMwareVCMSDS\Parameters\Port SSL was set to type REG_SZ and the data for the value was empty. I deleted the Port SSL value, re-added the value as a REG_DWORD with the data set to a decimal value of 636, restarted the VMwareVCMSDS service, and all is well.

Thanks to TheSaffaGeek for this fix.

February 2, 2011 | Filed Under Virtualization | 1 Comment 

Migration from vCenter 4.0 to 4.1 – One Geeks Journey…

When we first deployed VMware back in early 2008 vCenter was not yet supported running as a VM (at least I do not think it was). Since we were new to the technology as a whole I don’t think I would have run vCenter as a VM until we were able prove the stability of it in our production environment. Over the past few years I think VMware has proven itself as being robust and impressively stable so much so that we have virtualized every thing that is not nailed down tied to specific hardware – Exchange, Microsoft SQL, AD, web servers, application servers, etc. Since we need/want to upgrade to vCenter 4.1, it also seems like as good a time as any to go ahead and run vCenter as a guest VM.

Currently our vCenter is on a separate physical box running Windows 2003 with 4 GB RAM and a single 2.66 Ghz dual core processor. The vCenter database is on Microsoft SQL 2005 also running on the same physical box. The hardware we have in place would support running vCenter 4.1 but since 4.1 requires a 64 bit OS, and ours is currently running on 32bit, I am going to upgrade/migrate vCenter to a new guest VM running Windows 2008 R2 64. I am also going move the vCenter database to the new VM (I know it is not necessarily best practice to run the DB on the same box as vCenter but my environment is small and it should work out ok – if not I will move the database to another server at a later date) which is running Microsoft SQL 2005 x64.

Read more

January 31, 2011 | Filed Under My Notes, Virtualization | Leave a Comment 

Great Tweet…

This came across my twitter feed yesterday and I thought it was spot on…

@ChildRoland67 tweeted: My @VMware environment has been so stable for so long, I’m not sure I’d know what to do anymore if it broke.

Our VMware environment is also very stable and the issues that we do have from time to time are usually self-induced :)

January 25, 2011 | Filed Under Cool Stuff, Virtualization | Leave a Comment 

RVTools Version 3.0

RVTools 3.0 has been released.

Version info (Changelog) can be found here and you can download it from right here.

January 22, 2011 | Filed Under Tools, Virtualization | Leave a Comment 

VMware Cookbook

I just picked this up today – VMware Cookbook – A Real-World Guide to Effective VMware Use

Most of the book was written while vSphere was still in beta so the book covers ESX/ESXi 3.5 and Virtual Center 2.5.

I have only thumbed through it so far but it looks like there is a lot of good information. There are some pretty good tables with the configuration differences between 3.5 and 4 in Chapter 1. The command line reference in Chapter 5 should be useful to both versions, as well as the Security stuff in Chapter 6.

Looking forward to reading the book cover to cover.

vmwarecookbook

November 3, 2009 | Filed Under Virtualization | Leave a Comment 

Staging Patches in vSphere vCenter Update Manager

New feature in vCenter Update Manager allows you to stage vSphere updates before installing them.

Use the Stage wizard to download the patches before using remediation. This downloads and prepares the patches while the host is still online. This decrease the amount of time the host is off line (in maintenance mode) will applying patches.

Stage and Remediate in Upate Manager

Stage and Remediate in Upate Manager

You can stage at the cluster and Data Center level to prepare all hosts in the cluster for remediation.

Update Manager Stage Wizard

Update Manager Stage Wizard

Shortcuts in Home-Inventory-Hosts and Clusters

Stage and Remediate Host - Cluster and Data Center

Stage and Remediate Host - Cluster and Data Center

Just updated to ESX 4.0.0 build 175625. Staging took about 3 1/2 minutes total and remediation took about 12 minutes per host (this include Entering maintenance mode, VM migration, patch installation, reboot, exit maintenance mode). Three and a half minutes of savings may not seem like much, and across three hosts it really isn’t that big of a deal, but across 20 hosts that would make a huge difference.

Awesome new vSphere feature!

July 20, 2009 | Filed Under My Notes, Tools, Virtualization | Leave a Comment 

Enable Web Access on vSphere ESX 4

Not sure why this is but Web Access to ESX 4 is disabled by default.

To enable it ssh to the service console and log in as root.

[root@vmware]# chkconfig –level 345 vmware-webAccess on

Verify it has been enabled for run level 3, 4, and 5

[root@vmware]# chkconfig –list vmware-webAccess
vmware-webAccess 0:off 1:off 2:off 3:on 4:on 5:on 6:off

Start the service

[root@vmware]# service vmware-webAccess start
Starting VMware Virtual Infrastructure Web Access:
VMware Virtual Infrastructure Web Access [ OK ]

You can now log in a root at https://vmwareESXhostname/ui/

Does anyone know why VMware disabled this by default?

June 30, 2009 | Filed Under Virtualization | Leave a Comment 

VMware vSphere Evaluators Guide

VMware vSphere Evaluators Guide

Awesome resource for anyone looking into deploying or upgrading to vSphere 4.0

May 27, 2009 | Filed Under Virtualization | Leave a Comment 

Welcome

Thanks for dropping by! Feel free to join the discussion by leaving comments, and stay updated by subscribing to the RSS feed. Enjoy!
 

Not into geek stuff? Check out The VABiker.Net or SuffolkSky.com.
 

Why not Follow Me on Twitter?

 

  • Geek Reads

     
    • VMware vSphere 4.1 HA and DRS Technical Deepdive
      This technical guide covers the basic steps needed to create a VMware HA and DRS cluster, but even more important explains the concepts and mechanisms behind HA and DRS which will enable you to make well educated decisions. This book will take you in to the trenches of HA and DRS and will give you the tools to understand and implement e.g. HA admission control policies, DRS resource pools and resource allocation settings.
       
    • Mastering vSphere 4 by Scott Lowe
      Install and manage one or one thousand virtual servers in your enterprise with the latest generation of VMware virtualization software, vSphere 4, and this comprehensive guide.

    • vSphere 4.0 Quick Start Guide
      vSphere 4.0 Quick Start Guide continues from an idea started several years ago by a few engineers. The idea was simple, provide an easy to use reference guide for all level administrators, consultants and architects.