How to Uninstall SCEP Client using SCCM 2012 R2

Transcription

How to Uninstall SCEP Client using SCCM 2012 R2
How to Uninstall SCEP Client using SCCM 2012 R2
How to Uninstall SCEP Client using SCCM
2012 R2
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
ticketing tool 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:\Windows\ccmsetup\scepinstall.exe /u /s
http://prajwaldesai.com/how-to-uninstall-scep-client-using-sccm-2012-r2/
How to Uninstall SCEP Client using SCCM 2012 R2
Page 2 of 11
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_MACHINE\SYSTEM\CurrentControlSet\services\MsMpSvc" /f
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Antimalware" /f
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Security Client" /f
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Microsoft Antimalware" /
REG DELETE "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\Run\MSC"
REG DELETE "HKEY_CLASSES_ROOT\Installer\Products\4C677A77F01DD614880F352F9DCD9D3
REG DELETE "HKEY_CLASSES_ROOT\Installer\Products\4D880477777087D409D44E533B815F2D
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninsta
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninsta
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninsta
REG DELETE "HKEY_CLASSES_ROOT\Installer\UpgradeCodes\1F69ACF0D1CF2B7418F292F0E05
REG DELETE "HKEY_CLASSES_ROOT\Installer\UpgradeCodes\11BB99F8B7FD53D4398442FBBA
REG DELETE "HKEY_CLASSES_ROOT\Installer\UpgradeCodes\26D13F39948E1D546B0106B55395
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installe
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installe
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installe
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installe
takeown /f "%ProgramData%\Microsoft\Microsoft Antimalware" /a /r
takeown /f "%ProgramData%\Microsoft\Microsoft Security Client" /a /r
takeown /f "%ProgramFiles%\Microsoft Security Client" /a /r
REM Delete the MSE folders.
rmdir /s /q "%ProgramData%\Microsoft\Microsoft Antimalware"
rmdir /s /q "%ProgramData%\Microsoft\Microsoft Security Client"
rmdir /s /q "%ProgramFiles%\Microsoft Security Client"
http://prajwaldesai.com/how-to-uninstall-scep-client-using-sccm-2012-r2/
How to Uninstall SCEP Client using SCCM 2012 R2
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:\Windows\System32\wbem\Repository"
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.
http://prajwaldesai.com/how-to-uninstall-scep-client-using-sccm-2012-r2/
Page 3 of 11
How to Uninstall SCEP Client using SCCM 2012 R2
Page 4 of 11
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.
http://prajwaldesai.com/how-to-uninstall-scep-client-using-sccm-2012-r2/
How to Uninstall SCEP Client using SCCM 2012 R2
Page 5 of 11
Specify the name of the standard program, in the command line text box click Browse and
select the batch file and click Next.
http://prajwaldesai.com/how-to-uninstall-scep-client-using-sccm-2012-r2/
How to Uninstall SCEP Client using SCCM 2012 R2
No changes to be made here, click Next.
Click on Close.
http://prajwaldesai.com/how-to-uninstall-scep-client-using-sccm-2012-r2/
Page 6 of 11
How to Uninstall SCEP Client using SCCM 2012 R2
Page 7 of 11
[box type="info" radius="1"]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. [/box]
Right click on the package and click Deploy. Choose the Collection that you want to
deploy. Click Next.
http://prajwaldesai.com/how-to-uninstall-scep-client-using-sccm-2012-r2/
How to Uninstall SCEP Client using SCCM 2012 R2
Set the Purpose as Available. Click Next.
No changes to made here, click Next and complete the wizard.
http://prajwaldesai.com/how-to-uninstall-scep-client-using-sccm-2012-r2/
Page 8 of 11
How to Uninstall SCEP Client using SCCM 2012 R2
Page 9 of 11
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.
http://prajwaldesai.com/how-to-uninstall-scep-client-using-sccm-2012-r2/
How to Uninstall SCEP Client using SCCM 2012 R2
http://prajwaldesai.com/how-to-uninstall-scep-client-using-sccm-2012-r2/
Page 10 of 11