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
Principal Consultant and Enterprise Mobility MVP. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows deployments and Automation. In 2015 Nickolaj was awarded as PowerShell Hero by the community for his script and tools contributions. Author of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService and a frequent speaker at user groups.

(27)

There are no comments.

Leave a Reply