The topic is almost self explaining.
You need to monitor specific user-based certificates, to avoid a situation where they have already expired.
You can add this to your daily security compliance checklist.
Prerequisites for running CIs can be found here: Compliance Baseline prerequisites
-
Create Configuration Item
Go to Assets and Compliance, Compliance settings Configuration Items, right click and select Create a new configuration item:

Provide the name CI – Script – USER CERT Expiration check, leave the configuration item type as Windows and press Next:

Optionally you can provide a description that gives an overview of the configuration item and other relevant information that helps to identify it in the Configuration Manager console.
Select the OS where this configuration item assumes to be applied and click Next

To create Configuration Item, click New:

Type in the name CI – Script, from drop down of settings type select Script and data type as String.
There are two options to specify where a script would reside
– Discovery Script
– Remediation Script
Remediation is not handled in this post.
To place discovery script since to evaluate compliance, click on Add Script.
Please note that this script needs to be runin the logged-on user context, therefore please check “Run scripts by using the logged on user credentials”

Select script language as Windows PowerShell and type in the script (see attached USER_CERT_Expiration _Discovery.ps1) in the Script field:

#
$Compliance = ‘Compliant’
$Check = get-childitem -path cert:\currentuser -recurse | where-object {$_.thumbprint -eq ‘245c97df7514e7cf2df8be72ae957b9e04741e85’}| where { $_.notafter -le (get-date).AddDays(30)}
If ($Check) {$Compliance = ‘NonCompliant’}
$Compliance
#
Script download: [download id=”787″]
and click OK
Click Next

After the script is in place, you can click the “Compliance Rules” tab. Now compliance rule needs to be created. This rule will determine how the compliance is reported once the script runs on a computer (based on how the compliance a machine could be either Compliant or NonCompliant).
Click on New

Type in the com
pliance rule name and click on Browse:
Select the name of the configuration setting that just created (if not already selected and then click on Select):

In the Rule Type select Value and then select if the value returned is Equals to Compliant.
Click OK
Click Next

Next screen presents the summary of the settings, if any changes are needed then you can go back and make changes here. Click Next.

Configuration Item is ready now.

Next step is to create Configuration Baseline.
-
Create Configuration Baseline
Right click Configuration baseline and create configuration baseline.

Type the name of configuration baseline CB – Script – USER CERT Expiration check. Click on add and select configuration item from drop down menu.

Please make sure that Purpose set to Required!
Select the configuration item just created and click OK. This would finish creating configuration baseline.

Now it is time to deploy this base line to relevant Users Collection(-s).
-
Deploy the Configuration Baseline
Go to configuration baseline and right click and select Deploy.

Select the configuration baseline CB – Script – USER CERT Expiration check.
Browse and point it to targeted Users collection (its recommended to run it for some limited collection for testing before deployment to production)
Change the evaluation schedule as per as your requirements (taking in consideration that in case of it seems to be critical for your environment, in production running this CB probably once a day is recommended)
Again, the key thing here is to be sure that you deploy this CB to users and not to your systems!

Click OK
Note: When the configuration baseline is deployed, please allow that it can be evaluated for compliance within about two hours of the start time that you schedule.
-
Verify that a device has evaluated the Configuration Baseline
To check it on a Windows PC client (general recommendation to do it for all targeted OS client types)
On a Device, go to Control Panel, System and Security and open the Configuration Manager applet. In the Configurations tab you’ll see what Configuration Baselines the client will evaluate at its specific schedule. Click on configurations and click on “Evaluate”, “Refresh” and then “View Report”.
As shown in the pictures below, Configuration Baseline was evaluated to be Compliant or Not


