Skip to content

Create an Alert or Report for DP cert?

Featured Replies

Good afternoon,

Is there a built-in Alert or Report (or one that can be made simply enough) to send an email (or notify in the console) that the Distribution Point certificate is expiring within 30 days? Is this possible?

Thanks!

Jesse

Hello Jesse,

 

i just put that idea into a tiny script because that is something i will be end up using too. So thank's for the idea.

Just create a daily scheduled task that runs the script.

#####################################################################################################################
$rserver = 'smtprelay.mydomain' # your smtp relay server
$rport = '25' # your smtp relay server port
$from = 'sccm@mydomain' # make sure to edit mydomain
$to = 'my.name@mydomain' # your email address here
$subject = "IIS Certificate of $env:COMPUTERNAME expires soon"
$body = "The IIS certificate of $env:COMPUTERNAME is about to expire soon (xxx). Time to wake up mate."
$ipport = '0.0.0.0:443' # modify if you need to
$days = '30' # grace period before the script starts bothering you
######################################################################################################################

$warn = (Get-Date).AddDays($days)
$cmd = [string]"& netsh http show sslcert ipport={0}" -f $ipport
$certhash = (((Invoke-Expression $cmd | Where-Object {$_ -match 'Certificate Hash'}) -split ':')[1]).trim()
$cert = Get-ChildItem Cert:\LocalMachine\My -ErrorAction SilentlyContinue | Where-Object {$_.Thumbprint -eq $certhash}
$certexpire = $cert.NotAfter
if($certexpire -le $warn){
  $body = $body -replace 'xxx', $cert.NotAfter
  Send-MailMessage -SmtpServer $rserver -Port $rport -Subject $subject -From $from -To $to -Body $body
}

So long

Peter

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.