6 July 2016

Occasionally I get installers from vendors that just don’t play nice. OK… maybe it’s more than occasionally… Often it’s in the form of not having any parameters to do a nice, silent install and other times it’s one little quirky thing. Today that one thing was the uninstall of an MSI that forced a reboot despite using the /norestart parameter. My sripted install can handle reinstalling the app but the removal part kept forcing a reboot so the re-install never happened.

Super annoying and I don’t know why packages do forceful things like this. You really need to let the admin doing the software push decide these things. In my case, skipping the reboot causes no harm. After trying to strategically place  Shutdown -a  in my script (and failing to work) I got the idea that, if I initiate my own shutdown then the installer (or uninstaller) can’t force one of their own! So I tried it…

And it turned out I was right. Before I kicked off the uninstaller, which was an MSI, so in the form of msiexec.exe /X{GUID} , I used   shutdown -r -t 240  to schedule a reboot and give the uninstaller 4 minutes to run. The length of time can be anything as long as it’s enough time to get all of the tasks done because we’ll be cancelling it with   shutdown -a  once all the tasks are done.

Because Windows will only allow there to be one restart (pending or immediate) any shutdown command the package uses will be ignored and told there is already a pending system reboot.

The one drawback is that the scheduled shutdown is not silent.  In my company we use AutoIt so all I did was throw in a line to WinWait for the pending reboot notice to show up and then send an [Enter] to it.  There is still an icon in the tray and a balloon pops up when you cancel the reboot but that is fine with me.  I’m going to do a system restart at the end of my script anyway.

Hope this helps!


There are no comments.



You must be logged in to post a comment.

Links

RSS 2.0 Feed

Support

Brave Rewards
This site supports Brave Rewards. Please consider tipping or adding it to your monthly contributions if you find anything helpful!

For other ways: Support

Support this blog! If you have found it helpfu you can send me crypto. Any amount is appreciated!
ETH: 0xBEaF72807Cb5f4a8CCE23A5E7949041f62e8F8f0 | BTC: 3HTK5VJWr3vnftxbrcWAszLkRTrx9s5KzZ | SHIB: 0xdb209f96dD1BdcC12f03FdDfFAD0602276fb29BE
Brave Users you can send me BAT using the browser.