인증서에 대한 Get-ChildItem

업데이트 날짜: 2014년 5월

적용 대상: Windows PowerShell 4.0

Windows PowerShell Cert: 드라이브의 인증서 저장소 위치, 인증서 저장소 및 인증서를 가져옵니다.

구문

Get-ChildItem [-CodeSigningCert] [-DnsName <string>] [-EKU <string>] [-ExpiringInDays <int>] [-SSLServerAuthentication] [<CommonParameters>]

설명

Cert: 드라이브에서 Get-ChildItem cmdlet은 인증서 저장소 위치, 인증서 저장소 및 인증서를 가져옵니다. Windows PowerShell 인증서 공급자는 Windows PowerShell에 Cert: 드라이브를 추가합니다.

Windows PowerShell 3.0부터 인증서 공급자는 웹 호스팅에 대한 SSL(Secure Socket Layer) 인증서를 관리하기 위한 지원을 향상시킵니다. DNS 이름과 만료 날짜를 기준으로 인증서를 검색하고, EKU(확장된 키 사용) 속성의 값으로 클라이언트 및 서버 인증 인증서를 구분할 수 있도록 하기 위해 Get-ChildItem에 새로운 필터링 매개 변수인 DnsName, EKU, ,ExpiringInDays 및 SSLServerAuthentication이 추가되었습니다. 새로운 동적 매개 변수는 Windows 8, Windows Server 2012 및 최신 Windows 운영 체제 릴리스에서 실행되는 Windows PowerShell 3.0 이상에서 작동합니다.

또한 새 스크립트 속성인 DnsNameList 및 EnhancedKeyUsageList와 SendAsTrustedIssuer가 인증서를 나타내는 x509Certificate2 개체에 추가되었으므로 인증서를 쉽게 검색하고 관리할 수 있게 되었습니다.

DnsNameList 속성을 채우기 위해 인증서 공급자는 SAN(SubjectAlternativeName) 확장에서 DNSName 항목의 내용을 복사합니다. SAN 확장이 비어 있으면 속성은 인증서의 제목 필드에 있는 내용으로 채워집니다. EnhancedKeyUsageList 속성을 채우기 위해 인증서 공급자는 인증서에서 EKU(EnhancedKeyUsage) 필드에 있는 Friendly Name 및 OID 속성의 내용을 복사합니다.

참고: Get-ChildItem의 Name 매개 변수는 Cert: 드라이브에서 지원되지 않습니다. Cert: 드라이브의 항목을 지정하려면 Path 매개 변수를 사용합니다.

매개 변수

-CodeSigningCert

코드 서명 기관이 있는 인증서만 가져옵니다. 이 매개 변수는 EnhancedKeyUsageList 속성 값에 "Code Signing"이 포함된 인증서를 가져옵니다.

빈 EnhancedKeyUsageList가 있는 인증서는 어떤 용도로도 사용할 수 있으므로 코드 서명 인증서를 검색해도 EnhancedKeyUsageList 속성 값이 비어 있는 인증서가 반환됩니다.

이 매개 변수는 인증서 공급자의 모든 하위 디렉터리에 사용할 수 있지만 인증서에만 적용됩니다.

이 매개 변수는 Windows PowerShell 1.0에서 도입되었습니다.

필수 여부

false

위치

명명됨

기본값

False

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-DnsName <string>

인증서의 DNSNameList 속성에 지정된 도메인 이름 또는 이름 패턴이 있는 인증서를 가져옵니다. DnsName 매개 변수의 값은 Unicode 또는 ASCII일 수 있습니다. Punycode 값은 유니코드로 변환됩니다. 와일드카드 문자(*)를 사용할 수 있습니다.

이 매개 변수는 Windows PowerShell 3.0에서 도입되었습니다.

필수 여부

false

위치

명명됨

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

true

-EKU <string>

인증서의 EnhancedKeyUsageList 속성에 지정된 텍스트 또는 텍스트 패턴이 있는 인증서를 가져옵니다. 와일드카드 문자(*)를 사용할 수 있습니다. EnhancedKeyUsageList 속성에는 EKU의 이름 및 OID 필드가 포함되어 있습니다.

빈 EnhancedKeyUsageList가 있는 인증서는 어떤 용도로도 사용할 수 있으므로 모든 EKU 검색은 EnhancedKeyUsageList 속성 값이 비어 있는 인증서를 반환합니다.

이 매개 변수는 인증서 공급자의 모든 하위 디렉터리에 사용할 수 있지만 인증서에만 적용됩니다.

이 매개 변수는 Windows PowerShell 3.0에서 도입되었습니다.

필수 여부

false

위치

명명됨

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

true

-ExpiringInDays <int>

지정된 일 또는 그 이전에 만료되는 인증서를 가져옵니다. 정수를 입력하세요. 0값을 지정하면 만료된 인증서를 가져옵니다. 이 매개 변수는 인증서 공급자의 모든 하위 디렉터리에 사용할 수 있지만 인증서에만 적용됩니다.

ExpiringInDays 매개 변수는 인증서의 만료 날짜를 저장하는 인증서의 NotAfter 속성 값을 사용합니다. 유효 날짜는 인증서의 NotBefore 속성에 저장됩니다.

이 매개 변수는 Windows PowerShell 3.0에서 도입되었습니다. 이 매개 변수는 Windows 8, Windows Server 2012 이상의 Windows 운영 체제 릴리스에서 실행됩니다.

필수 여부

false

위치

명명됨

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-SSLServerAuthentication

SSL 웹 호스팅을 위한 서버 인증서만 가져옵니다. 이 매개 변수는 EnhancedKeyUsageList 속성 값에 "Server Authentication"이 포함된 인증서를 가져옵니다.

빈 EnhancedKeyUsageList가 있는 인증서는 어떤 용도로도 사용할 수 있으므로 SSLServerAuthentication 검색도 EnhancedKeyUsageList 속성 값이 비어 있는 인증서를 반환합니다.

이 매개 변수는 인증서 공급자의 모든 하위 디렉터리에 사용할 수 있지만 인증서에만 적용됩니다.

이 매개 변수는 Windows PowerShell 3.0에서 도입되었습니다.

필수 여부

false

위치

명명됨

기본값

False

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

<CommonParameters>

이 cmdlet은 일반 매개 변수 -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable, -Verbose, -WarningAction 및 -WarningVariable을 지원합니다. 자세한 내용은 about_CommonParameters를 참조하세요.

입력 및 출력

입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다. 반환 유형은 cmdlet에서 반환되는 개체의 유형입니다.

입력

System.String

Cert: 드라이브에서 Get-childitem에 경로를 파이프할 수 있습니다.

출력

Microsoft.PowerShell.Commands.X509StoreLocation, System.Security.Cryptography.X509Certificates.X509Store, System.Security.Cryptography.X509Certificates.X509Certificate2, System.String

Cert: 드라이브에서 Get-childitem은 인증서 저장소 위치, 인증서 저장소 및 인증서를 나타내는 개체를 반환합니다. Name 매개 변수를 사용하면 개체 이름을 문자열로 반환합니다.

참고

-- Windows PowerShell 3.0부터 Cert: 드라이브를 포함하는 Microsoft.PowerShell.Security 모듈을 모든 세션으로 자동으로 가져올 수 없습니다. Cert: 드라이브를 사용하려면 Import-Module cmdlet을 사용하여 모듈을 가져오거나 Cert: 드라이브를 사용하는 명령(예: "Set-Location Cert:")을 실행합니다.

--CodeSigningCert, DnsName, EKU 및 ExpiringInParameter 매개 변수는 인증서 공급자의 모든 하위 디렉터리에 사용할 수 있지만 인증서에만 적용됩니다.

예제 1

C:\PS>PS cert:\> Get-ChildItem

Location   : CurrentUser
StoreNames : {TrustedPublisher, ClientAuthIssuer, Root, UserDS...}

Location   : LocalMachine
StoreNames : {TrustedPublisher, ClientAuthIssuer, Remote Desktop, Root...}

Description
-----------
At the root of the Cert: drive, the Get-ChildItem cmdlet gets certificate store locations.





예제 2

C:\PS>PS cert:\LocalMachine\> Get-ChildItem

Name : TrustedPublisher

Name : ClientAuthIssuer

Name : Remote Desktop

Name : Root

Name : KRA

Name : TrustedDevices

Name : WebHosting

Name : CA

Name : REQUEST

Name : AuthRoot

Name : TrustedPeople

Name : My

Name : SmartCardRoot

Name : Trust

Name : Disallowed

Description
-----------
In a certificate store location in Cert: drive, the Get-ChildItem cmdlet gets certificate stores.





예제 3

C:\PS>PS cert:\LocalMachine\My\> Get-ChildItem

Thumbprint                                Subject
----------                                -------
D259F7B1DA04D41451866A2D464EC4A71BCBEDCD  CN=fabrikam-v6_CA, OU=Microsoft PKI Team
5B047DCA542A9E46C0EC7BF1AD7889612CADAA2E  CN=fabrikam-V6.dfabrikam-v5.fabrikam.com
3A37D8CEAA95E4FD099FC87F7E2779813D6BF4CC  CN=fabrikam-V6.dfabrikam-v5.fabrikam.com
2E0334D695038DFA40C1D982E5C296EFECA893BB  CN=fabrikam-V6.dfabrikam-v5.fabrikam.com
2C85D4CE7A0FA08FF66A4397B2F410071913D03B  CN=fabrikam-V6.dfabrikam-v5.fabrikam.com

Description
-----------
In a certificate store in Cert: drive, the Get-ChildItem cmdlet gets certificates.





예제 4

C:\PS>PS cert:\LocalMachine\My\> Get-ChildItem -Path D259F7B1DA04D41451866A2D464EC4A71BCBEDCD | Format-List -Property *

PSPath               : Certificate::LocalMachine\my\5B047DCA542A9E46C0EC7BF1AD7889612CADAA2E
PSParentPath         : Certificate::LocalMachine\my
PSChildName          : 5B047DCA542A9E46C0EC7BF1AD7889612CADAA2E
PSDrive              : cert
PSProvider           : Certificate
PSIsContainer        : False
EnhancedKeyUsageList : {Client Authentication (1.3.6.1.5.5.7.3.2), Server Authentication (1.3.6.1.5.5.7.3.1)}
DnsNameList          : {fabrikam-V6.dfabrikam-v5.fabrikam.com}
Archived             : False
Extensions           : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid,
                       System.Security.Cryptography.Oid, System.Security.Cryptography.Oid...}
FriendlyName         :
IssuerName           : System.Security.Cryptography.X509Certificates.X500DistinguishedName
NotAfter             : 4/21/2012 10:08:18 AM
NotBefore            : 4/22/2011 10:08:18 AM
HasPrivateKey        : True
PrivateKey           :
PublicKey            : System.Security.Cryptography.X509Certificates.PublicKey
RawData              : {48, 130, 6, 124...}
SerialNumber         : 220000000485E38FCF54250BCD000000000004
SubjectName          : System.Security.Cryptography.X509Certificates.X500DistinguishedName
SignatureAlgorithm   : System.Security.Cryptography.Oid
Thumbprint           : 5B047DCA542A9E46C0EC7BF1AD7889612CADAA2E
Version              : 3
Handle               : 545160087216
Issuer               : CN=fabrikam-v6_CA, OU=Microsoft PKI Team
Subject              : CN=fabrikam-V6.dfabrikam-v5.fabrikam.com

Description
-----------
This command displays all of the properties and property values of a certificate in a list. It uses the Get-ChildItem cmdlet to get the certificate and the Format-List cmdlet to display the properties.

If the value of a property is an object name, use dot notation to display the object value. For example, "(Get-ChildItem -Path D259F7B1DA04D41451866A2D464EC4A71BCBEDCD).IssuerName".





예제 5

C:\PS>Get-ChildItem -Path cert: -CodeSigningCert -Recurse

Description
-----------
This command uses the CodeSigningCert and Recurse parameters of the Get-ChildItem cmdlet to get all of the certificates on the computer that have code-signing authority. Because the full path is specified, this command can be run in any Windows PowerShell drive.





예제 6

C:\PS>Get-ChildItem -Path cert:\LocalMachine\WebHosting -DNSName "*fabrikam*"

Description
-----------
This command uses the DNSName parameter of the Get-ChildItem cmdlet to get all of the certificates in the WebHosting store whose domain names contain "Fabrikam".





예제 7

C:\PS>Get-ChildItem -Path cert:\LocalMachine\WebHosting -ExpiringInDays 30

Description
-----------
This command uses the ExpiringInDays parameter of the Get-ChildItem cmdlet to get certificates that will expire within the next 30 days.





예제 8

C:\PS>Invoke-Command -ComputerName Srv01, Srv02 -ScriptBlock {Get-ChildItem -Path cert:\* -Recurse -ExpiringInDays 0}

Description
-----------
This command uses the Invoke-Command cmdlet to run a Get-ChildItem command on the Srv01 and Srv02 computers. A value of zero (0) in the ExpiringInDays parameter gets all certificates on the Srv01 and Srv02 computers that have expired.





예제 9

C:\PS>Get-ChildItem -Path cert:\LocalMachine\My, cert:\LocalMachine\WebHosting -EKU "Server Authentication"

Description
-----------
This command uses the EKU parameter of the Get-ChildItem cmdlet to get all Server SSL Certificates in the My and WebHosting stores.





예제 10

C:\PS>Get-ChildItem -Path cert:\* -Recurse  -DNSName "*fabrikam*" -EKU "*Server*" | Where-Object {$_.SendAsTrustedIssuer -and $_.NotAfter -gt (get-date).AddDays.(30)}

Description
-----------
This command gets all certificates in the LocalMachine store location that have "fabrikam" in their DNS name, "Server" in their EKU, a value of $true for the SendAsTrustedIssuer property, and do not expire within the next 30 days. The NotAfter property stores the certificate expiration date.





See Also

Concepts

인증서 공급자

Other Resources

Get-Item
Get-PfxCertificate
Get-PSDrive
Move-Item
New-Item
Remove-Item