4 Best Ways to Repair SCCM Client Agent | Fix ConfigMgr Agent Issues
In this post, we will go through the steps to repair SCCM client agent to fix all agent issues. The best way to repair a Configuration Manager client agent is to use ccmrepair.exe. I will cover some additional methods using which you can easily fix your ConfigMgr agent issues by repairing them.
I often get emails asking for the steps to repair SCCM client agent, and I do reply to the emails with the repair steps. Furthermore, I decided to write a post, and I can now ask users to use this article as a reference for these types of queries, or Google will probably do so.
When you encounter problems with the client agent, you might want to repair the SCCM client. Be it SCCM client WMI issues, client health issues etc. Some admins prefer to uninstall the sccm agent and then install it. This procedure is called as ConfigMgr client reinstallation. Reinstalling the client agent will take more time when compared to the repair operation. Using the command line, the sccm client agent can be repaired quickly with ccmrepair.
When you install Configuration Manager in your setup, you install the SCCM client agents on all your endpoints. After you install the agents, you can manage your endpoints using Configuration Manager.
When you want to install a Configuration Manager client agent on a computer, you use the ccmsetup.exe command. By providing client installation parameters on the command line, you can modify the installation behavior. There is no repair parameter that you can run with ccmsetup.exe.
Table of Contents
Repair SCCM Client Agent using CCMRepair.exe Command Line
Using CCMRepair.exe, you can repair SCCM client agent via command line using below steps.
- Login to your computer. Run the Command Prompt as Administrator.
- Change the path to C:\Windows\CCM.
- To begin the SCCM client agent repair, run the command ccmrepair.exe.
It takes a few minutes to repair the ConfigMgr client agent. When I say repair, it basically means the client agent is reinstalled. If you see “Done” as the status, it means the client agent repair is successfully completed.
C:\Windows\CCM>ccmrepair.exe
Repairing product {88B420C9-C484-4E20-8D02-C25243A36B80}…
Done.
You can monitor the SCCM client agent repair process by reviewing the ccmsetup.log. The ccmsetup.log file is located in the C:\Windows\ccmsetup\Logs folder on the client computer. In addition, for other client logs, take a look at the SCCM log files.
The line CcmSetup is exiting with return code 0 confirms that SCCM client agent repair is completed successfully. You don’t have to restart your computer after you repair the ConfigMgr client.
Some of you may have a concern that SCCM client agent repair might remove all the folders present in CCMCache folder. However, when I verified this, if you run ccmrepair using command line, I noticed that folders were intact in CCMCache folder which is a good thing.
SCCM Client Agent Repair using Right Click Tools
Using the Right Click Tools, you can perform SCCM client agent repair with below steps.
- Launch the Configuration Manager console.
- Navigate to Assets and Compliance\Overview\Devices. Select a device for which you want to repair SCCM agent.
- Right-click the device and select Right Click Tools > Client Tools > Repair Client.
- You get a dialog box asking, “Are you sure you want to repair the client?“. Click Yes to proceed with repair.
Again, you can monitor the SCCM client agent repair process by monitoring the ccmsetup.log on the client computer.
One caveat of using the right click tools to repair SCCM client is it deletes the folders within ccmcache folder. The client cache is a temporary download location for software, applications, and updates deployed to a client. The client cache is located in %windir%\ccmcache. So keep that in mind when you use right click tools to repair the configuration manager client agent.
Using Run Script to Repair Configuration Manager Client
Once again, you can use ccmrepair.exe to repair the SCCM client agent, but this time we will use it with the “Run Script” feature in SCCM. The advantage of this method is that it allows you to repair the Configuration Manager client on multiple remote computers at once.
In the Configuration Manager console, go to Software Library\Overview\Scripts. Right click Scripts and click Create Script. On the Script details window, specify a script name such as Repair SCCM Client Agent and select the script language as PowerShell. We’ll use the ccmrepair command under Script to fix the Configuration Manager client agent. Enter the below command and click Next.
C:\windows\ccm\ccmrepair.exe
On the Completion window, click Close.
When you create a new script in Configuration Manager, you must approve the script. Sometimes the approve deny button may be disabled. Here is a solution to fix approve deny button disabled in SCCM. Right-click the SCCM client agent repair script and click Approve.
Once the client repair script is approved, go to devices. Select a device, right click and Run Script. As I mentioned earlier, you can also run the client repair script on device collections as well.
Select the repair SCCM client agent script and click Next.
Running this script will repair Configuration Manager client agent on device(s). On the client computer review the ccmsetup.log to monitor the client agent repair process.
PowerShell Script to Remotely Repair SCCM Client
Using the below PowerShell script, you can remotely repair SCCM client. This script is useful when you want to repair ConfigMgr client on a computer located in a remote site. To use this script, copy it to a notepad and rename it to ConfigMgAgentRepair.ps1. You can use the CMPivot to run this script or run this PowerShell script on the remote computer.
# Usage: SCCM-RepairClient <TargetName> function SCCM-RepairClient([String] $strTargetName) { $SCCMClient = [wmiclass] "\\$strTargetName\root\ccm:sms_client" $SCCMClient.RepairClient() }
SCCM Client Agent Repair FAQ
Some commonly asked questions and answers related to Configuration Manager client agent repair.
What is CCMRepair.exe?
ccmrepair.exe is an executable that allows you to repair Configuration Manager client agent.
What is the location of CCMRepair?
The ccmrepair file is located in C:\windows\ccm\ folder.
How do I Repair SCCM client agent?
To repair SCCM client agent on a computer, run ccmrepair.exe that is located in C:\windows\ccm\ folder.
What is the log file for CCMRepair?
You can monitor the SCCM client agent repair process by reviewing the ccmsetup.log. The ccmsetup.log file is located in C:\Windows\ccmsetup\Logs folder on the client computer.
How to Confirm SCCM Client Repair is Successful?
The line CcmSetup is exiting with return code 0 in ccmsetup.log confirms the SCCM client agent repair is successful.
Hi Prajwal,
I am trying to run a batch script through Group Policy on systems where either SCCM client is not installed or InActive/Corrupted so in this case, first i want to check if the Client is installed & healthy. How can i check above two conditioned through windows batch file.
Hello Prajwal,
Thanks for your extremely helpful insights. I have used Right-Click-Tools to accomplish this task and that generally does the trick however I liked the idea of being able to run the script against a collection of broken client machines. I have group policy set to only allow signed scripts so I created and signed a script that only contains the line you listed above. When I run the script using SCCM it fails because I set the time to 300 seconds and it doesn’t appear to complete. I tried running the script directly via Powershell and ccmrepair.exe and ccmsetup.exe are triggered but nothing seems to happen. The ccmsetup.log doesn’t get updated and the processes just sit there in task manager. I’m not sure what is going on here so I thought I would check in with you. Since the processes are being invoked, that indicates that this isn’t a problem with the script signing policy. Why else would ccmrepair.exe and ccmsetup.exe just hang indefinitely?
What is that 300 seconds of time that you mentioned?. When you trigger a client repair from the console, it will take time to begin the repair operation. However if you are logged in to the client machine and attempting to repair, the process should begin immediately. When you begin the client repair, if the ccmsetup.log is not updated, it means the repair operation is either blocked or there could be something else. Please contact me using my contact form and I will look into this.
ccmrepair immediately fails with error code 1605, which as far as I can tell means that it think it’s already uninstalled. I suppose this particular machine is simply too far gone.
Hi, if I see in SCCM Dashboard Assets that as one host SCCM client “No”, so can I use ccmrepair.exe for fix it?
Maybe not.(
Thanks for this. I searched for this because of the clearing ccmcache issue with RCT. One thing I changed for the Run Script option in CM was Start-Process “C:\windows\ccm\ccmrepair.exe” so that it doesn’t wait for the process to finish within the PS window itself.
If the SCCM client activity is Inactive or NO still we can push the repair script?
Yes but the client may remain inactive unless you fix the root issue.
Dear Prajwal,
if I did the SCCM Client installation from a .bat file with parameters and after that I try to fix the corrupted client with CCMRepair it will keep the options?
If the high speed communication channel is still functional and sometimes it is, the run script will work just fine.
If SCCM Client is broken can we run scripts to repair it.