Lab Manager 4 Guest Customisation

I think I lost count of the hours I spent trying to understand how LM 4 handled customising a guest O/S. In my case I wanted to deploy Windows XP and Windows 7 systems.

For those of you that have never done an large scale office deployment let me just just say that Windows 7 and dare I say Vista brought about some big changes in the way deployments went down. All for the better. In fact I really should get some posts up around the Vista and Windows 7 deployments that I have done over the last few years.

For lab manager that also meant that the customisation of each OS was totally different. I am hoping that with my scripts and notes below I may save someone else some pain.

Pre Requisites

  • Sysprep must be enabled in LM and have a Sysprep package built (only required if using Sysprep and a supported OS, XP, 2003 etc)
  • Template must have LM version of VM tools installed into it using the LM console
  • Template must have required customisation script created on the template

Building a Sysprep package

This is documented in the LM user guide but it wont detail some extra steps that were taken here at Thomson. In order to get Netdom and any other files required I placed them in the $oem$ and the root of the Sysprep folder on SVLAB01. I doubt it needs to be in both places but this seemed to work.

The folders are located here

c:\Program Files\VMware\VMware vCenter LabManager\Tools\CustomizeGuest\Windows\Sysprep\WinXProgram files\vmware\labmanager\tools\guestcustomization\windows\sysprep\winxp\i386\$OEM$

C:\Program Files\VMware\VMware vCenter Lab Manager\Tools\CustomizeGuest\Windows\Sysprep\WinXP

The reason for copying the files here are that they are copied over by the guest customization process by default and meant an easier time writing the script as files existed.

Creating the template

This can be created manually or using an SCCM deploy for example. The only pre-reqs for this customisation to work is that the template cannot be joined to the domain and must have the LM version of VM tools installed.

To ensure you have the LM version of tool deploy the template and then open it in LM. Viewing the console in LM you will see an install VM tools button above it. This is detailed in the LM user guide.

Guest Customisation Adding the Template Settings

Windows 7

Windows 7 already has Sysprep available in the System32 folder. So we don’t have to worry about having a Sysprep package built.

Unless you go to the trouble of installing the RSAT tools you won’t have NETDOM available to do something similar to XP. So we will have to use Powershell and the add-computer cmd-let.

Here is how it’s pieced together…

A share on the lab manager server has been created called LM$ which located on the root of the C drive C:\labmanager customisation scripts

On the windows 7 template the following has been added to the guest customisation

The windows temp folder has been used as a location to copy to. When the machine is deployed for the first time the following will happen

 

  1. Windows 7 will boot and get to the logon screen. At this point Sysprep is called and takes a few minutes to run, the machine will reboot
  2. VMware tools will call guest customisation whilst Windows is configuring itself
  3. Guest customisation will just show as a DOS box with little info (not helpful!) but it’s running what you tell it to in the picture above. It will never fail on an error and stop the process.
  4. Once its finished and windows has finished the net result should be a machine sitting on the CTRL ALT DEL screen and not a local user prompt.

 

Powershell Script

 

The powershell script is using the add-computer cmd-let. However in order to get this to work with out being prompted for a password you are required to do some more leg work. By default the command will prompt for a password. Below is an annotated version of the scripts contents.

 

$credential = New-Object System.Management.Automation.PsCredential(“tdl\ztit”, (ConvertTo-SecureString “thomson” -AsPlainText -Force))

 

This first line create the magic that does not require you to enter a password. It creates the $credential variable and uses a new object to store the password in.

 

Add-Computer -DomainName “tdl.net” -Credential $credential

 

The final line calls the cmd-let and the $variable that we have used.  We can also specify an OU for the machine to be added to by using this command instead

 

Add-Computer -DomainName “tdl.net” -Credential $credential -OUPath (“OU=Windows7,DC=tdl,DC=net”)

 

For more info check this page out http://iboyd.net/index.php/2009/10/23/windows-7-is-missing-netdom-exe/

Troubleshooting

 

As I mentioned earlier the customization stage will never fail or give you any output. However there is once saving grace in the Guest-Customization log that is stored on the machine you are trying to deploy in the %temp% (Windows\temp) In Win 7 you will have to take ownership when prompted to view the contents. This log file also exists in XP as well.

 

Windows XP

 

As stated earlier the NETDOM files are already copied for us by the guest customization process so we can just call it from the templates settings directly as shown below.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: