Have you ever felt the pain of trying to automate configmgr enhanced detection methods / enhanced detection rules using PowerShell? I know. it hurts. It feels like scripting VBS in notepad like in the old days: It makes me cry blood!

sccm enhanced detection method

 

But search no more. We got your back!

How to create a ConfigMgr enhanced detection method with powershell?

Here are two gists that will help to create the SCCM application deployment type enhanced detection method. Please fork, and contribute, to avoid that any other system engineer looses his sight while scripting ConfigMgr.

And here is the Set-SCCMDetectionRuleForDeploymentType that will allow you to add sccm enhanced detection method to an existing application.

I’ll try to update the functions with the missing parts if have a chance. But, if you happen to have already written sccm enhanced detection rule / sccm enhanced detection method for one of the following types:

  • Folder
  • MSI
  • Assembly

Don’t hesistate to participate and contribute to the code above 🙂

My configmgr application deployment type enhanced detection method/ enhanced detection rule does not work?!

These functions will only work if you load the correct DLL’s first. For that I have written the following function. Simply call the function at the top at your script (or prior to calling one of the above functions).

Feel free to fork and contribute to improve the automation process of the Configmgr application deployment type enhanced detection method.

 

Don’t miss these interesting sources to learn more about configmgr enhanced detection methods!

Some other interesting sources concerning configmgr enhanced detection methods. Some of them really helped in understanding how all of this works, and helped me creating the functions above

Lauries Rhodes excellent article to create configmgr enhanced detection methods –> Here 

Peter Hinchley blog post on how to create file based detection method –> Here

If you are into Csharp, you should defenitly look into the following blog post of Adam Meltzer –> Here

But the biggest of the kuddos goes to Rob Looman which found the Csharp hack –> here