MSEndpointMgr

Applications in Software Center uninstall with Removal Failed

During the package migration phase to the new application model in ConfigMgr 2012, I came across some quite anoying behaviour. It looks like that uninstallation executables created with NSIS, starts a process called Au_.exe and the uninstaller itself terminates. This will lead to the Application discovery (running after the uninstall.exe has succesfully terminated) will detect that the application is still present. The Au_.exe process will continue to run and you may manually or unattended complete the uninstallation. But in Software Center, you’ll see that the actual status is Removal Failed. If you click on Retry, the status will eventually change to Available, if the Au_.exe process has completed its uninstallation.

This is how it looks like (C:\Windows\CCM\Logs\AppEnforce.log on the client) when the uninstall.exe, in this case for VLC, is being called and then quickly terminates.

Executing Command line: "C:\Program Files (x86)\VideoLAN\VLC\uninstall.exe"
Working directory C:\Program Files (x86)\VideoLAN\VLC
Post install behavior is BasedOnExitCode
Waiting for process 8796 to finish. 2012-08-15 16:40:01
Process 8796 terminated with exitcode: 0 2012-08-15 16:40:01
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 VLC 2.0.3(ScopeId_214AE3....
Discovered application [AppDT Id: ScopeId_214AE354-794E-4740-ACED-4D....

You’d now see the Removal Failed in Software Center, while either your manual uninstallation will appear or your unattended uninstallation will run. In order to solve this, you’d have to either use a batch- or vb-script. I first tested with this batch-script:

@echo off
START "VLC" /W "C:\Program Files (x86)\VideoLAN\VLC\uninstall.exe"
ping -n 60 127.0.0.1>nul
EXIT /B 0

But I didn’t want the Software Center to give me Removal Failed after 60 seconds, if the user forgot about the uninstall for some reason. So instead I googled a bit (I’m no VB-script guru) and came up with this vb-script:

strPath = """%ProgramFiles(x86)%\VideoLAN\VLC\uninstall.exe"""
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run strPath
Set WshShell = Nothing
Wscript.Sleep 5000

set svc=getobject("winmgmts:root\cimv2")
sQuery="select * from win32_process where name='Au_.exe'"
set cproc=svc.execquery(sQuery)
iniproc=cproc.count
Do While iniproc = 1
wscript.sleep 5000
set svc=getobject("winmgmts:root\cimv2")
sQuery="select * from win32_process where name='Au_.exe'"
set cproc=svc.execquery(sQuery)
iniproc=cproc.count
Loop
set cproc=nothing
set svc=nothing

This script will launch the uninstall.exe for VLC and query WMI for Au_.exe and see if it’s running. The script has been modified a tiny bit from it’s author (https://www.computerhope.com/forum/index.php?topic=129625.0)

This is how it looks like (C:\Windows\CCM\Logs\AppEnforce.log on the client) when using the vb-script to call the uninstall.exe:

Executing Command line: "C:\WINDOWS\System32\ws ... mcache\q\uninstall.vbs"
Working directory C:\Program Files (x86)\VideoLAN\VLC
Post install behavior is BasedOnExitCode
Waiting for process 9192 to finish. 2012-08-15 18:18:19
Process 9192 terminated with exitcode: 0 2012-08-15 18:18:35
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 VLC 2.0.3(ScopeId_214AE354-....
Application not discovered. [AppDT Id: ScopeId_214AE354-794E-4740-ACED-....

I hope this helps someone out there!

Btw, this is my first blog post. Woho!

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.

5 comments

  • I want to know how to edit this so it could work for iTunes. I have windows 8 and my iTunes is “uninstalled”. I don’t have admin rights so there’s some info on that. I know it is a year late or so, but any help would be great. Thanks!

    • Hi Jesse,

      This is the first time I run into this question, so forgive me for not having an answer. I believe though that since the clients local policy consists of instances in specific WMI classes, holding information about the CI, that Software Center is designed to show this information. Unless there’s a method on any of the classes to remove such information, I don’t think it’s possible. At least not in any supported way anyhow.

      You can use WMI Explorer (https://wmie.codeplex.com/Wikipage?ProjectName=wmie) to explore the WMI classes under root\ccm to see if you can find such a method you’re looking for. I’d highly doubt it though that such a method exists.

      Regards,
      Nickolaj

  • Thanks! Am having the exact same issue with VLC, so used your script.

    Thought i’d write a comment so you know your first blog post was useful to someone 😀

Sponsors

Categories

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