Configuration Manager Client Automatically Reinstalling? Use Compliance Settings to Remediate

Every day is an adventure, isn’t it? Well, the other day was no different, really. My friend, co-worker, and ConfigMgr cohort Jason Rutherford was discussing with me an issue that had just popped up in an environment he is managing. As it seems, several clients were failing to install software in the middle of execution. However, there was no real rhyme or reason.

 

Apparently, my brain has made somewhat of a recovery from my early college days, because memory served me well that day. I remembered that, several weeks back, a client of mine had discovered that several ConfigMgr clients were reinstalling daily. After digging deeper, he found a scheduled task on these machines that initiated a reinstallation of the client every day. Certainly, this was from a botched initial installation, but there was no easy way to tell how many culprits were in the wild.

 

Lesser folk would spend their day trying to locate such instances and manually remove the scheduled tasks in an effort to resolve this issue. But we are not lesser folk. You are not lesser folk. We must automate this.

 

First thing is first: locate the path to the scheduled task. Now, interestingly enough, it resides in “\Microsoft\Microsoft\Configuration Manager” (it created a sub-directory called “Microsoft” under “Microsoft”, which is surely a hint to a botched client install).

CMScheduledTask

 

Secondly, let’s detect and remediate. We took the approach of leveraging compliance settings along with PowerShell to detect and ultimately remediate the issue. To do so, we need to first create the Configuration Item, add that to a Configuration Baseline, then deploy to our client machines.   Create the configuration item as follows:

CM_TASK_COMPLIANCE000260

CM_TASK_COMPLIANCE000261

We decided that we only really care about Windows 7 and 8.1 workstations at this point:

CM_TASK_COMPLIANCE000262

Add the detection and remediation scripts (bottom of this post):

CM_TASK_COMPLIANCE000263

CM_TASK_COMPLIANCE000264

Go to the Compliance Rules tab, add the value from the script that returns if compliant (in this case, the string “Compliant”) and check the boxes to remediate and report noncompliance:

CM_TASK_COMPLIANCE000265

CM_TASK_COMPLIANCE000266

Next, create your baseline and add the CI:

CM_TASK_COMPLIANCE000267

CM_TASK_COMPLIANCE000268

CM_TASK_COMPLIANCE000269

CM_TASK_COMPLIANCE000270

Once created, we deployed to the baseline out (All Systems in this demo; you probably want to narrow your collection down):

CM_TASK_COMPLIANCE000271

In the properties of the deployment, we made sure to remediate when supported and generate an alert if the compliance was below 90%:

CM_TASK_COMPLIANCE000272

That’s it! While this does not exactly solve the puzzle as to why those scheduled tasks are present, this will both repair the issue and allow you to see how widespread it is. Plus, we automated the solution, so you can spend more time finding new beers. That’s what life’s all about anyway, right? **************************SCRIPTS**************************

## Detection Script

 

## Remediation Script

By |2019-01-25T08:33:34+00:00June 24th, 2015|PowerShell, SCCM|0 Comments

About the Author:

Model Technology

Let us help you get your end point and data center strategy on cruise control!  Ask about our Calibration Assessment.

CONTACT US

  • 12125 Woodcrest Executive Drive, Ste. 204 Creve Coeur, MO 63141
  • (314) 254-4138
  • sales@model-technology.com

RECENT TWEETS