DANGER, WILL ROBINSON! DANGER! THIS ARTICLE IS OVER A YEAR OLD AND IS POSSIBLY OUT OF DATE! THE INFORMATION CONTAINED WITHIN MAY NOT BE ACCURATE ANYMORE! PROCEED WITH CAUTION!
At work, we have finally grown up. By that, I mean we finally have a centralized antivirus product that is actually up to date and doesn’t suck as bad as the old Symantec antivirus we were using. As a replacement, we used Security Essentials and the only thing that moved us to a new platform was the fact that we were technically out of compliance with the MSE license. In a business environment, Microsoft allows you to have only 10 copies installed on computers. We were past that. By like a lot.
One of the challenges of moving to our new AV solution was removing this program from our computers en masse. With several sites and many versions of MSE, you can bet that this was no easy task. Well, since I’m your typical lazy network administrator, I don’t have the time to sit there and manually remove every installation… so I automated it with a shut down script!
This script is a batch file that runs on shut down (or you could run it on start up if you really wanted). Originally, I found a VBS script that caused the computers to hang for about 10 minutes or so on shutdown every time. I’m not a VBS person at all… I love batch files and Powershell, and since I couldn’t Powershell this, I batched it!
The code to use:
@echo off if exist "%ProgramFiles%/Microsoft Security Essentials" ( START /wait "Uninstalling MSE" "%ProgramFiles%/Microsoft Security Essentials/setup.exe" /x /s ) else ( if exist "%ProgramFiles%/Microsoft Security Client" ( START /wait "Uninstalling MSE" "%ProgramFiles%/Microsoft Security Client/setup.exe" /x /s ) else ( exit ) ) )
Save this as a batch file and create a shutdown (or startup) GPO and have it run this batch file.
Here’s what it does:
- Does the path %ProgramFiles%/Microsoft Security Essentials exist? Yes? Run Setup.exe with silent parameters and uninstall parameters. No? Go on to the next line.
- Does the path %ProgramFiles%/Microsoft Security Client exist? Yes? Run Setup.exe with silent parameters and uninstall parameters. No? Go on to the next line.
This way there is an escape clause and there is no hang up and if there’s an older version of MSE installed, it’s removed as well.