Windows

Get the DN of your Windows account from AD

You know how it is. A nice, nested OU structure in AD. Everything beautifully organised in containers with weird and wonderful names. There’s a new guy who needs an account creating. Needs the same permissions as you. Simplest answer is to copy the account. But you didn’t set your account up so you have no idea where in the beautifully organised tree it is.

For a quick answer, run this VBScript:

set objSysInfo = CreateObject("ADSystemInfo")
set objUser = GetObject("LDAP://" & objSysInfo.UserName)
wscript.echo "DN: " & objUser.distinguishedName

Ah, found it. Of course, things would be much quicker with PowerShell but 4 hours ago I was the new guy and PowerShell doesn’t really exists that side of the firewall yet :-)

PowerShell 2.0 Installation Error

I was trying to install PowerShell 2.0 and kept getting an error part way through that simply told me that access was denied while installing the Windows Management Framework Core. The installation was then rolled back. I tried a few times, with local and domain administrator accounts but to no avail. The following event was logged each time in the system event log:

After some poking around I found that the local Administrators group did not not have Full Control of the registry key HKLM\Software\Microsoft\Windows NT\CurrentVersion\Svchost to which it was trying to write.

Just thought I’d share this in case anyone else encountered it.

SQL VM CPU Spikes

Some people still aren’t convinced by virtualisation and while it’s true that there are some situations that it’s not especially suited for they are relatively few in my experience. I know a few people who are yet to be convinced completely. One’s a SQL DBA and there are times when she has a point. I thought that this might be one of them until I started poking around.

screenshot_2009-12-04_18-25-21Initially I was asked about what was causing a SQL VM to respond slowly and use 100% CPU. I had a look in vCenter and while it looked slightly busy it didn’t seem over worked. As the graph to the right shows, it was using only about half of the available 3Ghz CPU it had access to. Perhaps I should explain further at this point that my client’s practice when it comes to VMs is to provision them with a single vCPU and add more if they are required. It seems that if this was normal load for the VM that 1 vCPU should be enough.

Looking back through the VM’s performance history I could see nothing particularly wrong either. Occasional CPU spikes in the past possibly indicating reboots or overnight processing. Oddly though there were random plateaus of activity for several hours at a time. Mostly overnight the VM would idle along using practically no CPU resource but during the day there were long periods where it looked a lot like the activity above. Time to look at the guest OS.

The picture inside Windows is slightly different. Opening up task manager shows frequent bursts of 100% CPU usage (see below). Actually you could call them regular. And, more worringly, it transpires that the server is not yet in production – it’s still being configured.

screenshot_2009-12-04_18-18-30

The offending process is services.exe so it’s not immediately obvious what the issue is. Purely by coincidence I asked the DBA if she could log off for a while so that I could look into what was going on. When she did, the strangest thing happenned:

screenshot_2009-12-04_18-27-18

See how the CPU usage dropped back down to idle and stayed there. That begged the question “What were you running?”.

It turns out that the culprit was none other than SQL Management Studio. When opened and connected it polls the server’s status every 10 seconds. Strangely though, instead of polling just the SQL services it polls all services on the server (this can be seen using Process Monitor) which seems a bit excessive to me. Due to the way that hypervisors share resources, what would be a small blip on a physical host is magnified within the VM somewhat. Microsoft have acknowledged that this happens but to my knowledge haven’t done much about it. There is a registry key that can be modified to adjust Management Studio’s behaviour. For SQL 2005 SP1 onwards (it’s not available before that) it is:

HKLM\Software\Microsoft\Microsoft SQL Server\90\Tools\Shell\PollingInterval

Setting it to 600 will reduce the frequency of polls to once a minute. Alternatively, just don’t leave SQL Management Studio open longer than you have to and wait for Microsoft to fix it.

Core Configurator

An acquaintance of mine (cheers Ray) found this after I asked him a few Server Core questions yesterday. The Core Configurator 2.0 is a graphical frontend to a collection of PowerShell scripts that will allow you to configure your Windows Server 2008 R2 Core VM very easily.

After downloading it locally, use the vSphere client to mount the ISO file on your VM. From within the command prompt on the guest OS, change drive to your CD / DVD drive (D: in my screenshot below) and just run the”Start_Coreconfig.wsf” file.

screenshot_2009-12-04_08-34-55

This opens a GUI with a few options for configuring Server Core.

screenshot_2009-12-04_08-42-37

I’m not going to go into too much detail about what can be done, try it yourself. But just as an example, compare the following window with the steps to configure networking using the command line.

screenshot_2009-12-04_08-43-37

Fantastic tool. I’ll be adding it to my toolkit for sure.

Installing VMtools on 2008 Server R2 Core

Have you ever wondered how to install VMtools on a Windows 2008 Server R2 Core guest running on an ESX 3.5 host? “Hang on,” you say, “R2 is officially supported on ESX 3.5!” And you’d be right, for the moment at least. ESX 3.5 U4 does indeed not support R2 officially yet although VMware support hinted that U5 is due at some point. Still, the customer is king and mine wanted an R2 VM.

First things first, the WoW64 Execution Layer needs to be installed and the server rebooted to allow R2 to run 32 bit applications.

Start /w ocsetup ServerCore-WOW64

shutdown /r /t 0

Once the reboot is complete and you’ve logged in again, select to Install the VM Tools for the VM. Nothing will actually happen except that ESX will mount the VMtools iso on the VM. To install the tools you’ll need to navigate to the drive where the iso has been mounted. In the example below it is the D: drive.

Installing the tools is then simply a case of silently executing the installer. This will automatically reboot the server afterwards.

msiexec /i "VMware Tools.msi" /passive

server-core-tools-install

That’s it, you’re done.