MSEndpointMgr

Install Adobe Reader 11.0.1 with a wrapper

So another Adobe Reader update was recently released. In the past I’ve experienced that if you try to install an update for Adobe Reader while there are AcroRd32.exe processes running, it may fail for numerous reasons. So I decided to create a wrapper that first kills all Adobe Reader processes and then installs the update.

The script I’m using looks like this

set objWMIService = GetObject ("winmgmts:")
foundProc = False
procName = "AcroRd32.exe"
for each Process in objWMIService.InstancesOf ("Win32_Process")
If StrComp(Process.Name,procName,vbTextCompare) = 0 then
foundProc = True
procID = Process.ProcessId
End If
Next
If foundProc = True Then
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process where ProcessId =" & procID)
For Each objProcess in colProcessList
objProcess.Terminate()
Next
WScript.Sleep(1000)
End If
strPath = """msiexec""" & " /update" & " AdbeRdrUpd11001.msp" & " /qn"
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run strPath, 1, True
Set WshShell = Nothing

Save the scripts to a .vbs file and create an application in ConfigMgr 2012 where you use the script as the install command. I saved the script as KillAdobeReader.vbs.
When it ran on a lab client, it successfully upgraded Adobe Reader 11.0.0 to 11.0.1.
The cool thing with this wrapper is that it waits for the msiexec process to finish. The row WshShell.Run strPath, 1, True (almost at the end) is the key for using the wrapper with ConfigMgr. If this was not included, the ConfigMgr client would have interpreted the upgrade as Failed since the app would not have had time to install completely until the Application Discovery part had taken place.
This is how it looked like when it had installed on the lab client:

Executing Command line: "C:\WINDOWS\System32\wscript.exe" "C:\WINDOWS\ccmcache\d\KillAdobeReader.vbs" with system context
Working directory C:\WINDOWS\ccmcache\d
Post install behavior is BasedOnExitCode
Waiting for process 4304 to finish. Timeout = 20 minutes.
Process 4304 terminated with exitcode: 0
Looking for exit code 0 in exit codes table...
Matched exit code 0 to a Success entry in exit codes table.
Performing detection of app deployment type Adobe Reader XI 11.0.1(ScopeId_214....
+++ Discovered application [AppDT Id: ScopeId_214...
++++++ App enforcement completed (63 seconds) for App DT "Adobe Reader XI 11.0.1" [ScopeId_214...

Nickolaj Andersen

Chief Technical Architect and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences such as Microsoft Ignite, NIC Conference and IT/Dev Connections including nordic user groups.

Add comment

Sponsors

Categories

MSEndpointMgr.com use cookies to ensure that we give you the best experience on our website.