description | external help file | Module Name | ms.date | online version | schema | title |
---|---|---|---|---|---|---|
Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell. |
Microsoft.CertificateServices.PKIClient.Cmdlets.dll-Help.xml |
pki |
12/20/2016 |
2.0.0 |
Get-Certificate |
Submits a certificate request to an enrollment server and installs the response or retrieves a certificate for a previously submitted request.
Get-Certificate [-Url <Uri>] -Template <String> [-SubjectName <String>]
[-DnsName <String[]>] [-Credential <PkiCredential>] [-CertStoreLocation <String>]
[-WhatIf] [-Confirm] [<CommonParameters>]
Get-Certificate -Request <Certificate> [-Credential <PkiCredential>] [-WhatIf] [-Confirm]
[<CommonParameters>]
The Get-Certificate
cmdlet can be used to submit a certificate request and install the resulting
certificate, install a certificate from a pending certificate request, and enroll for LDAP. If the
request is issued, then the returned certificate is installed in the store determined by the
CertStoreLocation parameter and return the certificate in the EnrollmentResult structure
with status Issued. If the request is made pending, then the request is installed in the machine
REQUEST store and a request is returned in the EnrollmentResult structure with status Pending.
This cmdlet can be used in a Stateless mode where this cmdlet does not look up anything in the vault or in a Stateful mode where it looks at registered certificate enrollment policy servers by identifier (ID) and credential. When used with a request object and no credential, this cmdlet will look up credentials in the vault based on the URL for the enrollment policy server.
This cmdlet will not accept a policy server identifier (ID). If a URL is not specified, then only the default certificate enrollment policy ID is used and the cmdlet will attempt to obtain policy information from any of its URLs.
Delegation may be required when using this cmdlet with Windows PowerShell remoting and changing user configuration.
$cred = Get-Credential
$params = @{
Template = 'SslWebServer'
DnsName = 'www.contoso.com', 'www.fabrikam.com'
Url = 'https://www.contoso.com/Policy/service.svc'
Credential = $cred
CertStoreLocation = 'Cert:\LocalMachine\My'
}
Get-Certificate @params
This example submits a certificate request for the SslWebServer
template to the specific URL using
the user name and password credentials. The request will have two DNS names in it. This is for a
certificate in the machine store. If the request is issued, then the returned certificate is
installed in the machine My store and the certificate in the EnrollmentResult structure is
returned with the status Issued. If the request is made pending, then the request is installed in
the machine REQUEST store and the request in the EnrollmentResult structure is returned with the
status Pending.
$cert = Get-ChildItem -Path cert:\LocalMachine\My\EEDEF61D4FF6EDBAAD538BB08CCAADDC3EE28FF
$params = @{
Template = 'SslWebServer'
DnsName = 'www.contoso.com'
Url = 'https://www.contoso.com/policy/service.svc'
Credential = $cert
CertStoreLocation = 'Cert:\LocalMachine\My'
}
$enrollResult = Get-Certificate @params
This example submits a certificate request to a specific URL using the certificate credential for authentication.
$params = @{
Template = 'WorkstationTemplate'
Url = 'https://www.contoso.com/service.svc'
}
Set-Location -Path Cert:\LocalMachine\My
$enrollResult = Get-Certificate @params
This example authenticates the URL using the machine account and Windows integrated authentication
and submits a request for a machine certificate of template named WorkstationTemplate
.
Set-Location -Path Cert:\CurrentUser\My
Get-Certificate -Template User -Url ldap:
This example uses Windows integrated authentication to enroll for a certificate of template User
using direct DCOM calls to the Certificate Authority.
$request = Get-ChildItem -Path cert:\LocalMachine\Request\EEDEF61D4FF6EDBAAD538BB08CCAADDC3EE28FF
$cred = Get-Credential
Get-Certificate -Request $request -Credential $cred
This example retrieves and submits a pending request using a user name and password as credentials.
$request = Get-ChildItem -Path cert:\LocalMachine\Request\EEDEF61D4FF6EDBAAD538BB08CCAADDC3EE28FF
Get-Certificate -Request $request
This example retrieves the certificate identified by $request
. If the authentication type for
$request.EnrollmentServer.AuthType
is not Kerberos, then look in the credential store to see if
there is a credential for $request.EnrollmentServer.Url
. If there is a credential, then use it. If
there is no credential, then Windows PowerShell will request it (if Windows PowerShell is in
Interactive mode).
Specifies the path to the certificate store for the received certificate. If the request is made pending, then the request object is saved in the corresponding request store.
Note
Only My
store is supported.
Type: System.String
Parameter Sets: SubmitRequest
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Prompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies the credential to use for certificate enrollment. The credential can be a user name and password (a credential object), an X509 certificate, or the path to a certificate. If a credential is not specified, then Kerberos authentication is used.
Type: Microsoft.CertificateServices.Commands.PkiCredential
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies one or more DNS names to be included in the certificate request as subject alternative name extension.
Type: System.String[]
Parameter Sets: SubmitRequest
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the X509 certificate or the path to a requested certificate located in the request store.
Type: Microsoft.CertificateServices.Commands.Certificate
Parameter Sets: PendingRetrieval
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies the subject name to be included in the certificate request.
Type: System.String
Parameter Sets: SubmitRequest
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the object identifier or name of a certificate template to use with the certificate request.
Type: System.String
Parameter Sets: SubmitRequest
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the policy server URL to use for certificate enrollment. Credentials are required if the endpoint requires a user name and password or certificate authentication from the client. If credentials are not found and Windows PowerShell is in interactive mode, then a prompt for credentials will appear.
Type: System.Uri
Parameter Sets: SubmitRequest
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
The Certificate object can either be provided as a Path object to a certificate or an X509Certificate2 object.
The Uri object can also be pipelined by the Url property name.
The EnrollmentResult object contains the results of enrollment.