How to Uninstall SCEP Client using SCCM 2012 R2 In this post we will see how to uninstall SCEP client using SCCM 2012 R2. I have been asked most of the times in my Support Forums on what is the easiest way to uninstall the System center Endpoint protection client from windows computer. Most of the admins prefer to uninstall the SCEP client using group policy or a logon script. Well, I believe that method works fine however I wanted to uninstall the SCEP client using SCCM. We will now create a script that uninstalls the SCEP client from Windows computers. We will basically create a package and add the script to that package and then deploy it to computers.

Create a new text document and rename it to “Uninstall MEP.bat“. Right click the batch file and edit with Notepad. Now add the below code to the batch file and save the file. Let me tell you this is a very simple code and works correctly.
@echo off C:Windowsccmsetupscepinstall.exe /u /s
If you are looking for a script that cleans up all the files associated with SCEP client then use the below script. I have had less success with the below script :). In this post I will be using the first code for uninstalling SCEP Clients.
cd /d "%ProgramFiles%Microsoft Security Client" TASKKILL /f /im MsMpEng.exe TASKKILL /f /im msseces.exe TASKKILL /f /im MpCmdRun.exe net stop MsMpSvc sc delete MsMpSvc REG DELETE "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesMsMpSvc" /f REG DELETE "HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft Antimalware" /f REG DELETE "HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft Security Client" /f REG DELETE "HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftMicrosoft Antimalware" /f REG DELETE "HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrent VersionRunMSC" /f REG DELETE "HKEY_CLASSES_ROOTInstallerProducts4C677A77F01DD614880F352F9DCD9D3B" /f REG DELETE "HKEY_CLASSES_ROOTInstallerProducts4D880477777087D409D44E533B815F2D" /f REG DELETE "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstallMicrosoft Security Client" /f REG DELETE "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall{774088D4-0777-4D78-904D-E435B318F5D2}" /f REG DELETE "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall{77A776C4-D10F-416D-88F0-53F2D9DCD9B3}" /f REG DELETE "HKEY_CLASSES_ROOTInstallerUpgradeCodes1F69ACF0D1CF2B7418F292F0E05EC20B" /f REG DELETE "HKEY_CLASSES_ROOTInstallerUpgradeCodes11BB99F8B7FD53D4398442FBBAEF050F" /f REG DELETE "HKEY_CLASSES_ROOTInstallerUpgradeCodes26D13F39948E1D546B0106B5539504D9" /f REG DELETE "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInstallerUserDataS-1-5-18Products4C677A77F01DD614880F352F9DCD9D3B" /f REG DELETE "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInstallerUserDataS-1-5-18Products4D880477777087D409D44E533B815F2D" /f REG DELETE "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInstallerUpgradeCodes11BB99F8B7FD53D4398442FBBAEF050F" /f REG DELETE "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInstallerUpgradeCodes1F69ACF0D1CF2B7418F292F0E05EC20B" /f takeown /f "%ProgramData%MicrosoftMicrosoft Antimalware" /a /r takeown /f "%ProgramData%MicrosoftMicrosoft Security Client" /a /r takeown /f "%ProgramFiles%Microsoft Security Client" /a /r REM Delete the MSE folders. rmdir /s /q "%ProgramData%MicrosoftMicrosoft Antimalware" rmdir /s /q "%ProgramData%MicrosoftMicrosoft Security Client" rmdir /s /q "%ProgramFiles%Microsoft Security Client" REM Stop the WMI and its dependency services sc stop sharedaccess sc stop mpssvc sc stop wscsvc sc stop iphlpsvc sc stop winmgmt REM Delete the Repository folder. rmdir /s /q "C:WindowsSystem32wbemRepository" sc stop PAUSE EXIT
After you are ready with the batch file, create a new package in SCCM. Right click Packages and click Create Package.
Specify the name for the package and browse to the folder where the script is located. Click Next.
Choose the program type as Standard Program. Click Next.
Specify the name of the standard program, in the command line text box click Browse and select the batch file and click Next.
No changes to be made here, click Next.
Click on Close.
Note – You need to distribute the content to the DP. Right click on the package and click Distribute Content. Proceed to the below steps only when the package is available with DP.
Right click on the package and click Deploy. Choose the Collection that you want to deploy. Click Next.
Set the Purpose as Available. Click Next.
No changes to made here, click Next and complete the wizard.
After few minutes, on the client computer the package is available. Select the package and click on Install.
On the client computer open the execmgr.log file for troubleshooting purpose. We see that the script has been executed and the SCEP client has been uninstalled successfully from the computer.
Still Need Help?
If you need further assistance on the above article or want to discuss other technical issues, check out some of these options.