PowerShell PKI Module Documentation

Documentation Home
This command requires installed Remote Server Administration Tools (RSAT)

Get-CertificateValidityPeriod

Synopsis

Retrives the maximum validity period value for issued certificates.

Syntax

Get-CertificateValidityPeriod [-CertificationAuthority] <CertificateAuthority[]> [<CommonParameters>]

Description

Retrieves maximum validity period for issued certificates. Though this setting is not absolute. Certificate actual validity period is the lesser value of the following: for Standalone CA:
– estimated CA certificate validity period
– ValidityPeriod parameter value.

for Enterprise CA:
– estimated CA certificate validity period
– certificate template validity period value
– ValidityPeriod parameter value.

Parameters

-CertificationAuthority <CertificateAuthority[]>

Specifies the Certification Authority object. This object can be retrieved by running Get-CertificationAuthority command.

Required? True
Position? 0
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? False

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, InformationAction, InformationVariable,
WarningAction, WarningVariable, OutBuffer, PipelineVariable and OutVariable.
For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

Inputs

PKI.CertificateServices.CertificateAuthority

Outputs

PKI.CertificateServices.CertValidityPeriod

Notes

Examples

Example 1

PS C:\> Get-CertificationAuthority -Name Company-CA | Get-CertificateValidityPeriod

Returns validity period settings for 'Company-CA' CA server.

Example 2

PS C:\> Get-CertificationAuthority | Get-CertificateValidityPeriod

Returns validity period settings for all Enterprise CA servers.

Example 3

PS C:\> Get-CertificationAuthority -Name Company-CA | Get-CertificateValidityPeriod | Set-CertificateValidityPeriod "10 years" -RestartCA

Sets certificate issued certificate validity period to '10 years'. After configuration is changed, the command will restart certificate services to immediately apply changes.

Example 4

PS C:\> Get-CertificationAuthority | Get-CertificateValidityPeriod | Set-CertificateValidityPeriod "5 years" -RestartCA

Sets certificate issued certificate validity period to '5 years' for all Enterprise CAs in the current forest and restarts CA service. After configuration is changed, the command will restart certificate services to immediately apply changes.

Related links

Get-CertificationAuthority
Connect-CertificationAuthority
Set-CertificateValidityPeriod

Minimum PowerShell version support

  • Windows PowerShell 3.0

Operating System Support

  • Windows 7
  • Windows 8
  • Windows 8.1
  • Windows 10
  • Windows 11
  • Windows Server 2008 R2 all editions
  • Windows Server 2012 all editions
  • Windows Server 2012 R2 all editions
  • Windows Server 2016 all editions
  • Windows Server 2019 all editions
  • Windows Server 2022 all editions