PowerShell Logo Small

New-CertificateNotificationTask



This is the built-in help made by Microsoft for the command 'New-CertificateNotificationTask', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Creates a new task in the Task Scheduler that will be triggered when a certificate is replaced, expired, or about to expired.

SYNTAX


New-CertificateNotificationTask [-RunTaskForExistingCertificates] -Channel <NotificationChannel> -Name <String> -PSScript <String> -Type <CertificateNotificationType>
[-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The New-CertificateNotificationTask cmdlet creates a new task in the Task Scheduler that will be triggered when a certificate is replaced or expires. The task will launch
the script specified by the PSScript parameter.


If the RunTaskForExistingCertificates parameter is specified, then after this cmdlet is registered, the cmdlet will go through all certificates (including archived
certificates) in the My store and initiate Replace events for all certificates with a Renewal property. The NewCertHash value will always be the one at the end of the
renewal chain. For example; if certificate A was renewed to certificate B, which was then renewed to certificate C, then the cmdlet fires two events: certificate A to
certificate C and certificate B to certificate C. This will ensure that applications that are still using old certificates are properly updated to the newest certificates.
If any certificate has a renewal chain longer than 20, then the certificate is not logged.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=287535
Get-CertificateNotificationTask
Remove-CertificateNotificationTask
Switch-Certificate

REMARKS

<

Examples


EXAMPLE 1

PS C:\>New-CertificateNotificationTask -PSScript C:\myscript.ps1 -Channel System -Type Replace -Name "My System Certificate Task"



This example creates a system notification task for certificate replacement events with the name My System Certificate Task that will launch the myscript.ps1 script located
on the C: drive. The cmdlet will run on the local system.




EXAMPLE 2

PS C:\>New-CertificateNotificationTask -PSScript C:\myscript.ps1 -Channel User -Type Expire -Name "My User Certificate Task"



This example creates a system notification task for the expiration and close-to-expiration certificate events with the name My User Certificate Task that will launch the
myscript.ps1 script located on the C: drive. The cmdlet will run for all currently logged on users in the user contexts.