4 Best Ways to Repair SCCM Client Agent
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.
Repair SCCM Client using 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 or 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() }
Need more help?
If you need further assistance on the above article or want to discuss other technical issues, check out some of these options.