Best Way to Uninstall SCCM Client | Remove ConfigMgr Client

This blog post will explain the Best Way to Uninstall SCCM Client. You can remove the ConfigMgr client from Windows 11 or Windows 10 PCs. Let’s understand how to uninstall the SCCM client (How to Remove ConfigMgr Client) from a Windows 10 or 11 device.

SCCM Client agent removal and cleanup is the most challenging part for many ConfigMgr Admins because there are different ways to uninstall or remove the ConfigMgr client. We will also see how to remove device records from the SQL database.

The following is one of the top-viewed posts: How to Uninstall and Remove SCCM Client using CCMClean exe | ConfigMgr. Microsoft no longer supports the CCMCean tool, but it still works. I don’t recommend uninstalling the ConfigMgr client using the CCMClean tool even though it will work (shh – I still believe this tool removes the client more cleanly).

Don’t worry about the source files of ConfigMgr Client software. I will share the details of the source file locations in the following section of this post. The client agent source files can be obtained from both the server and the client.

Patch My PC

Remove ConfigMgr Client from the Database

Before getting into the client software removal process, let’s understand how to remove the ConfigMgr client from SCCM SQL Database?.

Removing the ConfigMgr client software from Windows 10 computers does not remove the clients from the site database. The clients that are not updated are automatically purged from the site database after a while, depending on maintenance tasks /clean-up activities.

Adaptiva

Use the SCCM Administrator console to delete these clients immediately from the SMS site database.

  • Navigate to \Assets and Compliance\Overview\Devices.
  • Select the device record you want to delete.
  • Click on the Delete button.
Best Way to Uninstall SCCM Client | Remove ConfigMgr Client - Fig.1
Best Way to Uninstall SCCM Client | Remove ConfigMgr Client – Fig.1

Click the DELETE button from the Confirm Deletion Window.

Best Way to Uninstall SCCM Client | Remove ConfigMgr Client - Fig.2
Best Way to Uninstall SCCM Client | Remove ConfigMgr Client – Fig.2

Source File Location to Remove SCCM Client (Uninstall SCCM Client)

As mentioned above, The client agent source files can be obtained from both the server and the client. The following is the location of the client source files C:\Windows\ccmsetup.

You can use the CCMSetup.exe file from the Windows 10 devices. You can also get the latest Configuration Manager source files from the primary server share folder.

Source File Location to Remove SCCM Client (Uninstall SCCM Client)
Client Side (Windows 10) – C:\Windows\ccmsetup
Server Side – \\ServerName\sms_COD\Client
Replace the server name with your primary server FQDN.
Replace COD with ConfigMgr site code.
Best Way to Uninstall SCCM Client | Remove ConfigMgr Client – Table 1
Best Way to Uninstall SCCM Client | Remove ConfigMgr Client - Fig.3
Best Way to Uninstall SCCM Client | Remove ConfigMgr Client – Fig.3

Uninstall the SCCM Client using the CCMSetup.exe Command Line

You can use the command-line option to remove the SCCM client from Windows PCs. Let’s understand how to uninstall the SCCM Client using CCMSetup.exe as the command line.

Deleting a device record from the Configuration Manager console does not remove the client agent software from Windows 10 devices. To remove or clean up the end-to-end configurations of client software using the following command-line tool.

  • Open a Windows command prompt with the administrator’s permission.
  • Change the folder to the location mentioned above
    • Run the following command: cd %windir%\ccmsetup
  • Run the following command: CCMSetup.exe /uninstall
Best Way to Uninstall SCCM Client | Remove ConfigMgr Client - Fig.4
Best Way to Uninstall SCCM Client | Remove ConfigMgr Client – Fig.4

Logs Best Way to Uninstall SCCM Client | Remove ConfigMgr, Client

The SCCM client uninstallation process using CCMSetup.exe displays no results on the screen. However, you can watch the progress of the uninstall by reading the CCMSetup.log file using the CMTrace tool.

  • Location of the log file: %windir%\ccmsetup\logs\CCMSetup.log

CCMClean to Remove SCCM ClientUninstall SCCM Client using CCMClean

You can try to uninstall or remove the ConfigMgr Client using the CCMClean.exe tool. This is also a command-line tool. I have a more detailed explanation of the CCMClean tool in the following post. How to Uninstall Remove SCCM Client using CCMClean exe | ConfigMgr.

Well, CCMClean is not tested (extensively) and certified by Microsoft for the products ConfigMgr 2007/2012/CB. However, it may or may not work.

In my experience, the CCMClean.exe can successfully remove/uninstall ConfigMgr/SCCM 2007, 2012, and CB client components. More details are below……

Download – > CCMClean.exe

NOTE! – Microsoft does not support CCMClean.

Best Way to Uninstall SCCM Client | Remove ConfigMgr Client - Fig.5
Best Way to Uninstall SCCM Client | Remove ConfigMgr Client – Fig.5

The command-line parameters can be used with CCMClean.exe. Try to check out using “CCMClean.exe /?”

  • Silent install –> ccmclean.exe /q
Best Way to Uninstall SCCM Client | Remove ConfigMgr Client - Fig.6
Best Way to Uninstall SCCM Client | Remove ConfigMgr Client – Fig.6

Verify SCCM Client Agent Uninstall

Let’s verify that the SCCM Client Agent has been uninstalled using the log files and WMI. I tested CCMClean.exe on the SCCM / ConfigMgr 2012 client, and it worked perfectly!

  • a) Verify the CCMClean.log file to get more details.

CCMCleanup Logfile location = “C:\Users\administrator\appdata\local\temp” OR %temp%

  • b) Check the event log for more details or confirmation about the SCCM Client Agent Uninstall.

Check whether the registry entry has been removed from the SCCM client agent during the SCCM client agent uninstall process. You can also confirm whether the SMS Agent Host service has been REMOVED as a part of the SCCM client agent uninstall process.

You can use WBEMTEST to check whether SCCM client-related WMI namespaces (rootccm and rootcimv2SMS) have been REMOVED or not, as shown in the screenshot below. Once the SCCM client agent is removed or uninstalled, these WMI namespaces should also be removed.

Best Way to Uninstall SCCM Client | Remove ConfigMgr Client - Fig.7
Best Way to Uninstall SCCM Client | Remove ConfigMgr Client – Fig.7

PowerShell Script to Uninstall SCCM Client

Robertomoir shared a PowerShell script to uninstall or remove the SCCM client, including all the related folders. If you are a PowerShell enthusiast, use this method to uninstall or remove the SCCM client.

  • remove-sccm_remove-scam agent.ps1 – All credits to Rob Moir.
# Run SSCM remove
# $ccmpath is path to SCCM Agent's own uninstall routine.
$CCMpath = 'C:\Windows\ccmsetup\ccmsetup.exe'
# And if it exists we will remove it, or else we will silently fail.
if (Test-Path $CCMpath) {

    Start-Process -FilePath $CCMpath -Args "/uninstall" -Wait -NoNewWindow
    # wait for exit

    $CCMProcess = Get-Process ccmsetup -ErrorAction SilentlyContinue

        try{
            $CCMProcess.WaitForExit()
            }catch{
 

            }
}


# Stop Services
Stop-Service -Name ccmsetup -Force -ErrorAction SilentlyContinue
Stop-Service -Name CcmExec -Force -ErrorAction SilentlyContinue
Stop-Service -Name smstsmgr -Force -ErrorAction SilentlyContinue
Stop-Service -Name CmRcService -Force -ErrorAction SilentlyContinue

# wait for services to exit
$CCMProcess = Get-Process ccmexec -ErrorAction SilentlyContinue
try{

    $CCMProcess.WaitForExit()

}catch{


}

 
# Remove WMI Namespaces
Get-WmiObject -Query "SELECT * FROM __Namespace WHERE Name='ccm'" -Namespace root | Remove-WmiObject
Get-WmiObject -Query "SELECT * FROM __Namespace WHERE Name='sms'" -Namespace root\cimv2 | Remove-WmiObject

# Remove Services from Registry
# Set $CurrentPath to services registry keys
$CurrentPath = “HKLM:\SYSTEM\CurrentControlSet\Services”
Remove-Item -Path $CurrentPath\CCMSetup -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $CurrentPath\CcmExec -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $CurrentPath\smstsmgr -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $CurrentPath\CmRcService -Force -Recurse -ErrorAction SilentlyContinue

# Remove SCCM Client from Registry
# Update $CurrentPath to HKLM/Software/Microsoft
$CurrentPath = “HKLM:\SOFTWARE\Microsoft”
Remove-Item -Path $CurrentPath\CCM -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $CurrentPath\CCMSetup -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $CurrentPath\SMS -Force -Recurse -ErrorAction SilentlyContinue

# Reset MDM Authority
# CurrentPath should still be correct, we are removing this key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DeviceManageabilityCSP
Remove-Item -Path $CurrentPath\DeviceManageabilityCSP -Force -Recurse -ErrorAction SilentlyContinue

# Remove Folders and Files
# Tidy up garbage in Windows folder
$CurrentPath = $env:WinDir
Remove-Item -Path $CurrentPath\CCM -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $CurrentPath\ccmsetup -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $CurrentPath\ccmcache -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $CurrentPath\SMSCFG.ini -Force -ErrorAction SilentlyContinue
Remove-Item -Path $CurrentPath\SMS*.mif -Force -ErrorAction SilentlyContinue
Remove-Item -Path $CurrentPath\SMS*.mif -Force -ErrorAction SilentlyContinue 

Automation Option to Remove SCCM Client from Multiple Windows PCs

You will have some options to remove the SCCM client automatically using PSExec or another scripting method. We can run the CCMSetup.exe or CCMClean.exe on multiple remote machines using PSEXEC.exe. You should have administrative privileges on that remote machine.

Resources

We are on WhatsApp now. To get the latest step-by-step guides, news, and updates, Join our Channel. Click here – HTMD WhatsApp.

Author

Anoop C Nair has been Microsoft MVP for 10 consecutive years from 2015 onwards. He is a Workplace Solution Architect with more than 22+ years of experience in Workplace technologies. He is a Blogger, Speaker, and Local User Group Community leader. His primary focus is on Device Management technologies like SCCM and Intune. He writes about technologies like Intune, SCCM, Windows, Cloud PC, Windows, Entra, Microsoft Security, Career, etc.

6 thoughts on “Best Way to Uninstall SCCM Client | Remove ConfigMgr Client”

  1. Can you explain why it would be helpful to delete the device in the site database as well?
    I usually just uninstall with the ccmsetup and then remove the CCM folders. It haven’t caused any issues (as what i’ve noticed).

    Reply
    • Hi, your method is fine. You don’t need to delete the record from the console. It will automatically get deleted as per the configuration settings of the pre defined maintenance tasks.

      Reply
  2. Hi Anoop,

    we are going to decommissioning the existing sccm site sever. the thing is we have more than 300 machines, can you please share the process of ” how to uninstall sccm client agent in every machines at a time after decommission”

    Reply
  3. Hi when we try ccmsetup.exe /uninstall it shows

    The process cannot access the file because it is being used by another process.

    Have you ever run into this issue? How do we solve?

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.