Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Switch-Certificate

Switch-Certificate

microsoft.certificateservices.pkiclient.cmdlets.dll

Synopsis

Marks one certificate as having been replaced by another certificate.

Syntax

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

Detailed 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.

Aliases

None

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.

Aliases

None

Required?

false

Position

named

Default value

false

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.

Aliases

None

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.

Aliases

None

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.

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type

Microsoft.CertificateServices.Commands.Certificate

Return Type

None

Notes

None

Examples

EXAMPLE 1

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.

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

EXAMPLE 2

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.

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 

Online Version
Get-ChildItem
Set-Location
Get-CertificateNotificationTask
New-CertificateNotificationTask
Remove-CertificateNotificationTask