intuneWin - adding powershell cmds to uninstall app before isntalling new

Occasional Contributor

Having issues w/ superseded deployment with new app versions. 


Figured it might be easier to just deploy the new version and have PS run the uninstall of pre-existing first. 


If I want to have intunewin W32 package built I normally just point it to the setup.msi and go - works great. 


Any suggestions to do the following when building a W32 intunewin package


run PS and uninstall existing app (I have the msiexec /x string to uninstall the app. Then once removed (if not already there just proceed) and run the setup.msi for the upgraded app I want to deploy?






4 Replies
Create a poweshell script

First, I would "try" to check if the app is already installed and check if it has the right version you want to delete (I guess you could get that info from the registry) .
"if" the conditions are met, I would try to kill the app first to be sure nothing is running, then run the msiexec /x uninstall string (of course test the uninstall string first)
"else" install the app again with the msiexec silent switch

Something like that?

Thanks Rudy

Was looking for instructions for running a .bat file as the setup file for intunewin

Where the bat calls PS and deletes the file (I can do this)
then calls the msi to install new - this I dont understand.

If I want intunewin to run a PS script then run the installation? not clear how

best response confirmed by ScottonTap (Occasional Contributor)



You could create a powershell script which I mentioned earlier. Place that powershell script in the same folder as the installationfiles and convert it to a intunewin app


Here is how


Update Application via Win32App in Microsoft Intune - NielsKok.Tech


Upload it and change the install command to something likethis.