Mark Russinovich on Podnutz Podcast – 5/2/11 – 8PM EST

Mark Russinovich will be on the Podnutz Podcast show on May 2nd, at 8PM EST. He will likely take some questions towards the end of the podcast. Russinovich is an amazing guy: creator of Winternals/Sysinternals and pseudo son of Dave Cutler, he is the world’s top expert on the internal workings of Windows NT technology.

You should be able to listen in on the stream live at podnutz.com (main page), so put it on your calendar!

– Soli Deo Gloria

Dealing with Frankenstein Office Installs

Recently, I was working on upgrading our PCs from Office 2003 to Office 2007 through SCCM 2007.  This sounds easy enough, except for those “Frankenstein” builds we had.  Some of our users were using Excel 2007 with the rest of the Office 2003 suite, because Excel 2003 only handle up to 64,000 rows.  Unfortunately, loading two versions of Office leads to headaches, such as breaking Sharepoint integration.  It seems that if you install Office 2007, it will register its version of owssupp.dll.  Upon doing so, when you attempt to open Word/Excel/Powerpoint documents from a Sharepoint site, Internet Explorer crashes with an unknown exception. This is fixed by running this hotfix.  Unfortunately, loading hotfixes or service packs for either suite can re-register the incorrect version again and you have to start the process all over again.

The problem with trying to push out Office 2007 with a custom MSP to PCs with Frankenstein Office builds is that it would pop up a box asking what components of Office 2007 I wanted to add or remove.  Once any component of Office 2007 gets on a PC, the setup program ignores that Office 2003 is installed.  The solution is to remove Office 2007, if it is installed, but how?

After searching the Internet and getting some help from www.experts-exchange.com, I came up with this script:

Const HKCR = &H80000000
Const HLCU = &H80000001
Const HKLM = &H80000002
Const HKU = &H80000003
Const HKCC = &H80000005
strComputer = “.”
Set objShell = WScript.CreateObject(“WScript.Shell”)
Set filesys = CreateObject(“Scripting.FileSystemObject”)
Sub RegKeyExists(strHive, strKeyPath,strValueName)
Set objRegistry = GetObject(“winmgmts:\” & strComputer & “rootdefault:StdRegProv”)
objRegistry.GetStringValue strHive,strKeyPath,strValueName,strValue
If IsNull(strValue) Then
Wscript.Echo “Office 2007 is not installed”
Else
objShell.run(“msiexec /x{90120000-0011-0000-0000-0000000FF1CE} /quiet”),1,true
Wscript.Sleep 900000
End If
End Sub
If filesys.FileExists(“c:\Program Files\Microsoft Office\OFFICE11\STARTUP\PDFMaker.dot”) Then
filesys.MoveFile “c:\Program Files\Microsoft Office\OFFICE11\STARTUPPDFMaker.dot”, “c:\Program Files\Microsoft Office\OFFICE11\STARTUP\PDFMaker.old”
End If
RegKeyExists HKLM,”SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{90120000-0011-0000-0000-0000000FF1CE}”,”DisplayName”

I test for the existence of a specific registry key that will only exist if Office 2007 (any component) is installed. If it exists, I fire off msiexec to remove Office 2007.  You might be asking why I have a Wscript.Sleep 900000 statement right after this command.  It seems that msiexec fires off setup.exe and just quits.  Unfortunately, SCCM 2007 sees this as the VBScript has completed running and then attempts to fire another instance of setup to install Office 2007, which of course fails.  To prevent this, I put in a hard waiting period of 15 minutes (900000 ms).  No matter what you pass to msiexec (i.e. /norestart), it will restart the PC.  This catches SCCM 2007 off guard (since it is waiting for the script to exit gracefully) and on restart, it attempts to re-run the VBScript.  This time it just passes through, since Office 2007 is already removed.

Why rename pdfmaker.dot?  Well, that is because some computers had Acrobat 6 installed and pdfmaker.dot causes Excel 2007 to take 45 seconds or more to open.  To prevent this addin getting loaded by Excel 2007, we just rename it.

There is 1 more issue I ran into and that was with laptops.  As this package was firing during 12AM to 5AM, I had not anticipated that laptops would be turned on during this time.  I added this so it would “bomb out” on them so we could do them manually later on (stolen from my administrator removal script):

Set objWMIService = GetObject(“winmgmts://” & strComputer & “/root/cimv2”)
Set colItems = objWMIService.ExecQuery(“Select * from Win32_Battery”,,48)
IsLaptop = False
For Each objItem in colItems
IsLaptop = True
Next
If IsLaptop Then
wscript.stdout.write “Laptop, not running package”
wscript.quit(666)
Else
wscript.stdout.write “Not a laptop, continue running package”
End If

This will show up in the advertisement status with error code “666” which will make it stand out for sure!

– Soli Deo Gloria