PowerShell Logo Small

Switch-Certificate



This is the built-in help made by Microsoft for the command 'Switch-Certificate', 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

Marks one certificate as having been replaced by another certificate.

SYNTAX


Switch-Certificate [-OldCert] <Certificate> [-NewCert] <Certificate> [-NotifyOnly] [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Switch-Certificate cmdlet marks one certificate as having been replaced by another certificate. This cmdlet triggers a replace certificate notification and optionally
sets the renewal property on the certificate being replaced.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=287540
Get-ChildItem
Set-Location
Get-CertificateNotificationTask
New-CertificateNotificationTask
Remove-CertificateNotificationTask

REMARKS

<

Examples


EXAMPLE 1

PS C:\>Switch-Certificate –OldCert cert:\LocalMachine\My\E42DBC3B3F2771990A9B3E35D0C3C422779DACD7 –NewCert cert:\LocalMachine\My\4A346B4385F139CA843912D358D765AB8DEE9FD4



This example sets the renewal property of the certificate with the thumbprint E42DBC3B3F2771990A9B3E35D0C3C422779DACD7 as renewed by the certificate with the thumbprint
4A346B4385F139CA843912D358D765AB8DEE9FD4 and generates a replace certificate notification.




EXAMPLE 2

PS C:\>Set-Location -Path cert:\LocalMachine\My



PS C:\>$oldCert = (Get-ChildItem -Path E42DBC3B3F2771990A9B3E35D0C3C422779DACD7)



PS C:\>$newCert = (Get-ChildItem -Path 4A346B4385F139CA843912D358D765AB8DEE9FD4)



PS C:\>Switch-Certificate -OldCert $oldCert -NewCert $newCert –NotifyOnly



This example locates two certificates in the machine MY store and assigns them the variables $oldCert and $newCert. This cmdlet then generates a replacement notification
without changing a renewal property of the old certificate.