Anyone who works in the IT field (especially education) has had to, at one time or another, deal with the pesky crap that computer manufacturers ship out with the pre-installed version of Windows XP that comes standard. For those of us in higher ed, this means that, come September, a thousand brand-new desktops and laptops will arrive on campus, all chock-full of brand-new crap software just waiting to slow it down and block the installation of our McAfee VirusScan Enterprise 8.0i w/ePO solution. Fortunately, Jason York over at yorkspace.com has taken it upon himself to create an AutoIt script called the PC De-Crapifier that removes all the pre-installed Scheisse that comes on new Dell computers (although York has renamed the script with a more generic title, after Dell’s brand people contacted him). The script toasts the pesky McAfee Personal Firewall, Security Center, SpamKiller, and VirusScan Online trials, and offers you the chance to get rid of a bunch of other useless stuff. As a nice bonus, it automatically (if you choose) disables things like QuickTime from running on startup and sucking up valuable system resources. Given the nature and completeness of the script, I’d have to say Jason’s been there before, and hopefully, by using his script, we won’t have to be yet again this year. Mmmmmm….
When creating installers, it’s often necessary to stop running processes before beginning the actual install. For example, while creating an install of McAfee’s VirusScan Enterprise 8.0i, I discovered I needed to kill about 10 different processes associated with the free trial of McAfee Security Center and Personal Firewall that’s been showing up on all the new Dell laptops being shipped to my work. The trial is seriously insidious, since declining the free 90-day offer and closing all the appropriate windows, andexiting from anything McAfee-like in the system tray does nothing to stop those processes. They just keep on going, unless you end them from the Task Manager.
Now, for the purposes of rolling out VirusScan Enterprise to over 1,000 computers in the course of a few days, it would be rather impractical to ask users with varying degrees of computer savvy to terminate processes in a designated order prior to installing VSE.
Now, InstallShield has the built-in ability to call VBscripts within a Windows Installer (MSI), and you can launch a batch file from the installer easily by calling cmd.exe, as described on this MacroVision support page.
However, I found the VBscript solution was limited in its scope, as the ability to terminate a process does not extend to services. In order to kill a service (or SYSTEM process), you need to write a separate VBscript to kill services, since the command to terminate a process in userland will not translate over.
As to the batch file approach, you need to install the file first, then run it, since you can’t stream it into the binary data, so it plays havoc with your installer if you need to terminate processes before you copy files.
After trying a few batch files launched from the command line, and meeting with varying degrees of failure (probably due to my ignorance of proper sequencing), it occurred to me that there was a really simple way around this mess: taskkill.
Taskkill, otherwise known as the command I was launching from the batch file I was copying over to the destination machine in a nested MSI, can be launched in InstallShield 11.5 quite easily. Basically, you point the Working Directory over to the [SystemFolder] in a Custom Action, where taskkill.exe lives on every Windows NT based system. Then, enter the following command line:
“[SystemFolder]taskkill.exe” /f /im (processname)
In other words, to kill notepad.exe, type:
“[SystemFolder]taskkill.exe” /f /im Notepad.exe
Remember to set the Custom Action to ‘Synchronous (Ignores exit code)’ to avoid erroring out because of a lack of response from taskkill.exe after it terminates the designated process. I suggest placing these actions immediately after the CostFinalize action in the Execute sequence of the standard install.
Using this method, I was able to easily kill all 10 processes running with McAfee’s free trial software, and toast the software itself by running its uninstaller. An elegant and simple solution, arrived at through truly miserable and misguided trial and error.