< Back

Switch-Certificate

Wed Jan 30, 2019 5:58 pm

NAME Switch-Certificate



SYNOPSIS

Marks one certificate as having been replaced by another certificate.





SYNTAX

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





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.





PARAMETERS

-NewCert <Certificate>

Specifies an X509 certificate or a certificate path for the certificate that replaces the certificate specified with the OldCert parameter.



Required? true

Position? 2

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-NotifyOnly [<SwitchParameter>]

Creates a replacement certificate notification without replacing the NewCert parameter with the OldCert parameter.

This mode is useful when testing a script that was registered with the New-CertificateNotificationTask cmdlet.



Required? false

Position? named

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-OldCert <Certificate>

Specifies an X509 certificate or a certificate path in the certificate provider for the certificate to be replaced.



Required? true

Position? 1

Default value none

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value false

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value false

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

Microsoft.CertificateServices.Commands.Certificate



The Certificate object can either be provided as a Path object to a certificate or an X509Certificate2 object.





OUTPUTS

None









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.







RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=287540

Get-ChildItem

Set-Location

Get-CertificateNotificationTask

New-CertificateNotificationTask

Remove-CertificateNotificationTask