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

Marco Gaiarin gaio at lilliput.linux.it
Wed Feb 4 18:43:01 CET 2026


Mandi! Andreas Habel
  In chel di` si favelave...

> There are different approaches to solve this - the easiest would be this PowerShell command:
> 	Get-Package -Name "<application name>" | Uninstall-Package

Exactly what i've found.


> 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.

True that even with an '| Out-Null' at the end the progress bar get
displayed, but i've not trouble with this... seems to work, at least with
MSI, as expected...


> 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%'"'

Normally i run powershell without the '%COMSPEC% /C', eg without running
them on a CMD shell jail...

> - 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

Seems complicated... anyway, thanks.

-- 



More information about the wpkg-users mailing list