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

Marco Schmidt schmidt at fgcz.ethz.ch
Thu Mar 19 07:27:21 CET 2026


Hello,

I guess you need to add the "start /wait" before the "msiexec command.

<remove cmd='powershell -C "%COMSPEC% /c start "" /wait msiexec /q /x (Get-CimInstance -ClassName Win32_Product | 
Where-Object { $_.Name -like \"Oracle VirtualBox 7.2.6\" }).IdentifyingNumber REBOOT=ReallySuppress"' >

The wpkg.js itself uses WshScriptExec which monitors the direct process it executes.
In this case "msiexec" spawns and returns directly, which makes the powershell process to terminate, which is detected 
by WshScriptExec. But "msiexec" is still running.

https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/windows-scripting/2f38xsxe(v=vs.84)

I am not a powershell expert, but maybe there is a similar mechanism in powershell to wait for spawned process?

I found this:
https://theitbros.com/wait-for-a-command-powershell/

Which would lead me to this (untested):

<remove cmd='powershell -C "& msiexec /q /x (Get-CimInstance -ClassName Win32_Product | Where-Object { $_.Name -like 
\"Oracle VirtualBox 7.2.6\" }).IdentifyingNumber REBOOT=ReallySuppress | Out-Null"' >

Please tell us, if it worked.

Greetings ...
  Marco


On 16.03.26 10:41, Marco Gaiarin wrote:
> Mandi! Raimundas Andrijauskas
>    In chel di` si favelave...
> 
>> powershell -C "msiexec /x (Get-CimInstance -ClassName Win32_Product | Where-Object { $_.Name -like 'Adobe Acrobat Reader*' }).IdentifyingNumber /quiet /norestart"
> 
> WOW! Wonderful!
> 
> I've only a problem with that: seems that powershell get 'spawned' and exit
> before real uninstall, so this onliner work but check condition get
> evaluated before uninstallation, so recipe fail.
> 
> I've tried to wrap powershell in a 'start "" /wait':
> 
> 	<remove cmd='%COMSPEC% /c start "" /wait powershell -C "msiexec /q /x (Get-CimInstance -ClassName Win32_Product | Where-Object { $_.Name -like \"Oracle VirtualBox 7.2.6\" }).IdentifyingNumber REBOOT=ReallySuppress"' >
> 
> but nothing changed. Probably is powershell itself that spawn the msiexec
> process in background.
> 
> 
> How can i fixt it? Thanks.
> 



More information about the wpkg-users mailing list