Migrating Office Communicator Clients via GPO / VBS Script

Hi there, if you're new here – LifeChurch.tv just completed a migration from Microsoft Live Communications Server 2005 to Microsoft Office Communications Server 2007 R2.  We primarily use OCS for internal IM, but I hope to add some more SIP functionality down the road.

One of the last steps of the migration is actually migrating the Office Communicator client from v2005 to v2007 R2 for all our PC users.  We have about 250 of these users in 14 locations in 6 states.  Long gone are the manual uninstall – reinstall days.  Sure, that's easy to do for testing and for a few users, but for "mass" deployment, we need a better way.  And, one of the most common ways is via Active Directory Group Policy Objects (GPO).

First – The VBS Script
So, we needed a way to script the removal of the old client and install the new client.  We wanted a script that would run as the user logs in, and remove OC 2005, and install OC 2007 R2.  Here's a hiccup – Communicator 2005 launches at login, so, we also wanted to "shutdown" OC 2005 before we removed it. I got the "remove" / "install "part done – it's simple MSI switches.  I had trouble with the rest of it.  But, because Andrew is so smart, his google-fu found some helpful links.  This link was helpful too.  Here's the script, in full:

Option Explicit
Dim theShell, strComputer, objWMIService, colProcessList, objProcess

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")

Set colProcessList = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_Process WHERE Name = 'Communicator.exe'")

For Each objProcess in colProcessList
 objProcess.Terminate()
Next

Set theShell = WScript.CreateObject("WScript.Shell")
theShell.Run "msiexec.exe /i path.to.fooCommunicator2007R2.msi /qn"
Set theShell = Nothing
Set strComputer = Nothing
Set objWMIService = Nothing
Set colProcessList = Nothing
set objProcess = Nothing

WScript.Quit(0)

If you follow that, basically, it looks at all running processes for "Communicator.exe" – and if it finds it – it kills it.  Then, it runs the MSI file for OC 2007 R2 with the /i (install) and /qn (quiet) switches.  the MSI itself handles the OC 2005 uninstall and OC 2007 R2 install.

So, head to a machine that has OC 2005 – navitage to the "path" that has the VBS script – and double click on it.  Wait a minute.  Your OC 2005 process will stop.  OC 2005 will be uninstalled and OC 2007 will be installed.  It's MAGIC!  But, that's not scalable to 250 people in 6 states.  We need to handle this automatically.  Let's put that script somewhere taht EVERYONE can get to.  Let's also make sure the MSI is somewhere everyone can get to also.  One possible location, just for testing, is the domainNETLOGON location.  That's not really the best place though.

Next – Create An AD Group
Great, now we have a script.  Let's identify a set of users to migrate (maybe a pilot group at first, and then the full-scale set of users).  There's no real need to get into this.  If you're reading this, I hope you know how to create AD Security Groups.  So, create one – I called mine OCMigrationUsers – and put a few users in there to test with.  I added myself.  I'm the guinea pig – always.

Picture 16

Great.  Moving on.

Next – The Group Policy Object
So, now we have a script.  And, we have identified users to migrate.  Let's create a GPO that will run that script when those users login.

Bring up your Handy Dandy Group Policy Management Console

Picture 10

Navigate to the GPOs, right-click and choose New

Picture 11

Give it a useful name – like – OC2007R2ClientInstall.  Click OK.  This takes you back to the list of GPOs.  Find the one you just created, right-click on it, and choose EDIT

Picture 12

Expand User Configuration, Expand Windows Settings, Select Scripts and then choose Logon Script.  Double click.

Picture 14

Here's where you add scripts.  Click Add.

Picture 15

You can either Browse, or enter the "path" to your script.  Click OK.  Then, click OK again to get back to your GPO Editor.  Close the Editor to get back to your Group Policy Object (the Management Console).  Pay attention to the Security Filtering – on the right side.

Picture 17

Ours looks like this.  We want only the OCMigrationUsers to get this GPO.  So, adjust yours accordingly. Now, let's double check the actual "delegation" of this GPO.

Picture 18

In the upper right-hand corner of the GPO, click the Delegation Tab.

Picture 19

Yup, now click Advanced.

Picture 20

Great.  OCMigrationUsers can "Read" the GPO and they are to "Apply" the GPO.  That's right.  Click OK.

Now, it's time to "link" the GPO.  For us, we want to link it at the domain level – that's "unity.com" – so, go back to your Group Policy Management Console.

Picture 21

Navigate to the domain, right-click, and choose "Link an Existing GPO"

Picture 22

Choose the right GPO – Click OK.

Picture 24

Great – it's linked.  Navigate now and select the actual GPO itself

Picture 25

Yup, all looks good.  Let's put this all together.

Applying & Testing GPO – Will it work?
Okay, time to test this.  I'm testing with a Windows XP VM on my Macbook Pro.

Picture 26

You can see the OC 2005 program is installed.  You can also see that it's "running" ni my Tooltray down by the clock in the bottom-right-hand corner – the red-X icon.

Let's reboot the computer.  Time Passes.  Computer comes back up.  We login.  Wait a minute.  Now, open Control Panel and look at the installed programs.

Picture 27

That's good.  OC 2005 is gone.  OC 2007 R2 is there.  Let's check the Application Event logs – Open the Event Viewer.

Picture 28

The Application log shows an entry for MsiInstaller – that's what we want.  Double Click that.

Picture 29

Yup.  Script ran.  OC 2007 R2 – Installation completed successfully.

You can also check the applied GPO too – drop to a command prompt and run "gpresult"

Picture 30 

There ya go.  OC2007R2ClientInstall – GPO Applied.  All is well!

Now, time for mass deployment.  I guess we'll have to figure out who is next, eh?

I hope this was helpful.  Tell me if it was.

2 thoughts on “Migrating Office Communicator Clients via GPO / VBS Script

Comments are closed.