Comments on this page are supposed to improve article content and no technical support is provided. For technical questions, please visit project home page at: https://github.com/Crypt32/PSPKI

Get-CertificateTemplate

[This command is not available in non-domain environments]

[This command requires installed Remote Server Administration Tools (RSAT)]

Get-CertificateTemplate

Synopsis

Retrieves registered certificate templates from Active Directory.

Syntax

Get-CertificateTemplate [-Name <String[]>] [<CommonParameters>]

Get-CertificateTemplate [-DisplayName <String[]>] [<CommonParameters>]

Get-CertificateTemplate [-OID <String[]>] [<CommonParameters>]

Description

Retrieves registered certificate templates from Active Directory.

Parameters

-Name <String[]>

Specifies common name of a template to retrieve. You can specify multiple template names by separating them with comma character (,).

Note: this parameter don't accept wildcards

Required? False
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-DisplayName <String[]>

Specifies display name of a template to get. You can specify multiple display names by separating them with comma character (,).

Note: this parameter don't accept wildcards

Required? False
Position? named
Default value *
Accept pipeline input? false
Accept wildcard characters? False

-OID <String[]>

Specifies object identifier (OID) of a template to get. You can specify multiple template OIDs by separating them with comma character (,).

Note: this parameter don't accept wildcards

Required? False
Position? named
Default value  
Accept pipeline input? false
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 (http://go.microsoft.com/fwlink/?LinkID=113216).

Inputs

None.

Outputs

PKI.CertificateTemplates.CertificateTemplate

Notes

Author: Vadims Podans
Blog: https://www.sysadmins.lv

Examples

Example 1

PS C:\> Get-CertificateTemplate

Retrieves all registered certificate templates from Active Directory.

Example 2

PS C:\> Get-CertificateTemplate -DisplayName Computer

Retrieves only certificate template with display name 'Computer'.

Example 3

PS C:\> Get-CertificateTemplate -Name WebServer, CrossCA

Retrieves certificate templates with common names 'WebServer' (Web Server) and 'CrossCA' (Cross Certification Authority).

Example 4

PS C:\> Get-CertificateTemplate -OID 1.3.6.1.4.1.311.21.8.149510.7314491.15746959.9320746.3700693.37.1.14

Retrieves certificate template that has assigned OID = 1.3.6.1.4.1.311.21.8.149510.7314491.15746959.9320746.3700693.37.1.14 (default Machine/Computer template).

Related links

Remove-CertificateTemplate

PowerShell Support

  • PowerShell 3.0

Operating System Support

  • Windows XP
  • Windows Vista
  • Windows 7
  • Windows 8
  • Windows 8.1
  • Windows Server 2003 all editions
  • Windows Server 2008 all editions
  • Windows Server 2008 R2 all editions
  • Windows Server 2012 all editions
  • Windows Server 2012 R2 all editions

Comments:

jkchen99
jkchen99 09.11.2016 23:35 (GMT+3)

Through the use of DsAcls can effectively wotk out. suas as, 

PS C:\dsacls "CN=UserCert,CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=corp,DC=lab,DC=com"

 

Otherwise, Get-Certificate -Template  filter * {ldap_search_s(ld, "CN=Configuration,DC=corp,DC=lab,DC=com", 2, "(&(objectClass=*)(cn=usercert))", attrLis&msg)

 

ZC80
ZC80 30.06.2017 14:02 (GMT+3)

Hi,

I've been trying to use your PS script for CA backup. With some slight modifications to adjust it ot our system, it works fine, except for this part - the backup of the templates. I get the following error:

"Get-CertificateTemplate : The term 'Get-CertificateTemplate' is not recognized as the name of a cmdlet, function, script
 file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct a
nd try again."

from the line $Templates = Get-CertificateTemplate -Name MyCertTemp

Could you please tell me what i'm doing wrong? Keep in mind that i'm not very skillful with PS.

Thanks

Captcha