Tuesday, November 6, 2012

Upgrading Silverlight 4 to 5 with Active Directory Group Policy

I was recently asked to look into an issue with upgrading Silverlight 4 to version 5 because creating a new Software Installation package with version 5 did not upgrade the desktops that had version 4 installed.  Searching on the internet didn’t shed any more light into the issue so I decided to simply create a batch file that would uninstall Silverlight 4 then install version 5.  I’m sure I will be coming across a similar situation again so this blog post will serve as something I can reference to in the future.

Begin by creating a new GPO and assign it to the OU containing the desktop objects that you would like to have Mozilla Firefox uninstalled. Edit the policy and navigate to Computer Configuration –> Policies –> Windows Settings –> Scripts (Startup/Shutdown):

image

Double click on the Startup option to bring up the properties, then click on the Add… button:

image

In the Edit Script window, click on the Browse button:

image

From within the Browse window, right-click in Startup folder to create a new Text Document then name it UpgradeSilverLight4to5.bat:

clip_image002

Edit the batch file and paste in the following:

wmic product where caption='Microsoft Silverlight' call uninstall
\\<Fileserver>\<SomePath>\Silverlight\silverlight.msi

**Note that the first line silently uninstalls Silverlight and the second line installs the new version from a network file share.

image

Save the batch file then select it to return to the Edit Script window. Continue by clicking the OK button:

clip_image002[4]

The script should now be shown in the Startup Properties window. Proceed by clicking on the OK button:

clip_image002[6]

The desktops with this new GPO assigned will now silently uninstall Silverlight 4 upon the start up of Windows then installs Silverlight 5. Note that this policy should be unassigned when you’ve confirmed that all of the desktops/laptops have Silverlight upgraded so it doesn’t get executed every time a user restarts their computer.

----------------------------------------------------------------------------------------------------------------------------------------------------------------

WMIC Command

I’ve found that many administrators aren’t aware of the Windows Management Instrumentation Command-line (WMIC) command that allows you to list certain applications installed on the server/desktop:

clip_image002[8]

I find myself using this command quite a bit when automating uninstalls for applications that don’t provide a silent switch.  More information about this command can be found in the following TechNet article:

http://technet.microsoft.com/en-us/library/bb742610.aspx

No comments: