Share via


Get-SPCertificate

Returns all certificates that match the specified criteria.

Syntax

SearchFilters (Default)

Get-SPCertificate
    [-DisplayName <String>]
    [-Thumbprint <String>]
    [-SerialNumber <String>]
    [-Store <String>]
    [-InUse]
    [-DaysToExpiration <Int32>]
    [-AssignmentCollection <SPAssignmentCollection>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Identity

Get-SPCertificate
    [-Identity] <SPServerCertificatePipeBind>
    [-AssignmentCollection <SPAssignmentCollection>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Get-SPCertificate cmdlet returns either a single certificate that matches the Identity parameter, or all the certificates that match the filtering criteria of the optional parameters. If no parameters are specified, all certificates in the farm are returned.

Examples

EXAMPLE 1

Get-SPCertificate -DisplayName "Team Sites Certificate"

This example gets all certificates in the farm with the display name "Team Sites Certificate".

EXAMPLE 2

Get-SPCertificate -InUse -DaysToExpiration 30

This example gets all certificates that are in use and will expire within the next 30 days.

Parameters

-AssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Parameter properties

Type:SPAssignmentCollection
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DaysToExpiration

If a positive number, only return certificates that will expire in the number of days from now specified by this parameter. Specify "-1" to only return certificates that have already expired. Specifying "0" will result in no filtering based on expiration date.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchFilters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisplayName

The display name of the certificate to find. Use this parameter instead of the Identity parameter if multiple certificates might match this criteria. The Identity parameter can only return a single certificate.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchFilters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Identity

Specifies the display name, thumbprint, serial number, or GUID of the certificate to find. If multiple certificates match the identity specified, no certificates will be returned. Use the filtering criteria of the optional parameters when multiple certificates would match.

The type must be a valid display name, in the form "Certificate Display Name", a valid thumbprint, in the form "1234567890ABCDEF1234567890ABCDEF12345678", a valid serial number, in the form "1234567890ABCDEF1234567890ABCDEF", or a valid GUID, in the form "12345678-90ab-cdef-1234-567890abcdef".

Parameter properties

Type:SPServerCertificatePipeBind
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Identity
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-InUse

Specifies to only return certificates that are directly assigned to SharePoint objects (i.e. currently in use).

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchFilters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SerialNumber

The serial number of the certificate to find, in the form "1234567890ABCDEF1234567890ABCDEF".

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchFilters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Store

Specifies the certificate store to search. If this parameter isn't specified, all certificate stores will be searched.

Parameter properties

Type:String
Default value:None
Accepted values:EndEntity, Intermediate, Pending, Root
Supports wildcards:False
DontShow:False

Parameter sets

SearchFilters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Thumbprint

The thumbprint of the certificate to find, in the form "1234567890ABCDEF1234567890ABCDEF12345678".

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchFilters
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.