[wpkg-users] In memory of WMIC...

Andreas Habel andreas.habel at uis.no
Tue Feb 3 08:42:02 CET 2026


Hi Marco,

I was facing the same problem. 

There are different approaches to solve this - the easiest would be this PowerShell command:

	Get-Package -Name "<application name>" | Uninstall-Package

However, the command shows a progress bar when run in a command line window, something that WPKG does not like, and I was not able to find a way to suppress the output.

What I am doing now for all MSI packages is the following:
- In my WPKG package xml file, I call a PowerShell script:
	'%COMSPEC% /C powershell.exe %WINDIR%\uis\temp\uis-uninstall.ps1 -appname "'%PROGNAME%'"'

- In the PowerShell script, I run:
	$uninstallData=Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | Get-ItemProperty | Where-Object { $_.DisplayName -match "$appname" } | Select-Object -Property UninstallString
	with $appname being the option -appname you called the script with

- $uninstallData has the property UninstallString that contains whatever is in the registry under UninstallString

- Since the UninstallString value in the registry often contains an install string (MsiExec /I instead of MsiExec /X), you will need to extract the GUID

- In the next step, you can uninstall like this:
	$Arguments = @(
        "/X"
        "$guid"
        "/qn"
	)
	$MSIExec = (Start-Process -FilePath "C:\Windows\System32\msiexec.exe" -ArgumentList $Arguments -Wait -Passthru).ExitCode

Andreas	


-- 
Andreas Habel
Petroleum engineering lab
Geosciences | Unix network
Faculty of Science and Technology
University of Stavanger
Norway

T: +47 51 83 22 93
M: +47 99 35 69 63

-----Original Message-----
From: wpkg-users <wpkg-users-bounces at lists.wpkg.org> On Behalf Of Marco Gaiarin
Sent: Tuesday, January 27, 2026 6:32 PM
To: wpkg-users at lists.wpkg.org
Subject: [wpkg-users] In memory of WMIC...


In my recipes i've used sometime some WMIC query, and now Microsoft have
totally deprecated it; in the latest Win11 24H2 upgrade i got,  i can enable
the WMIC feature, but keeps in a 'Staged' state and does not work.


Google halped me to port some query from WMIC to powershell, but i've not
found a way to port some query like:

        wmic product where "Name like 'Adobe Acrobat Reader % MUI'" call uninstall /nointeractive

i use query like this in some recipes to do some 'cleanup' before installing
some precise software version.

I've found the query part, as:

        Get-CimInstance -Class Win32_Product | Where-Object { $_.Name -eq "Adobe Acrobat Reader*" }

but how to call the uninstall part, with silent option?


Thanks.

PS: i've tried:
        Get-Package -Name "Adobe Acrobat Reader*" | Uninstall-Package -Force

and seems to work at least for MSI, but something like this:

        Get-Package -Name "BCUninstaller*" | Uninstall-Package -Force

does not work... does nothing...

--



---------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
_______________________________________________
wpkg-users mailing list
wpkg-users at lists.wpkg.org
https://lists.wpkg.org/mailman/listinfo/wpkg-users
Denne eposten er sendt utenfra organisasjonen. Vurder om det er trygt å åpne lenker og vedlegg.
This email originated from outside of the organization. Please consider whether it is safe to open links and attachments.


More information about the wpkg-users mailing list