PROVIDER NAME
Certificate
DRIVES
Cert:
SYNOPSIS
Provides access to X.509 Certificate stores and Certificates from within Windows PowerShell.
DESCRIPTION
The Windows PowerShell security strategy supports the use of Authenticode signatures to sign scripts using X.509-encoded digital public key Certificates. The signing features of Windows PowerShell are not intended to be complete, but they enable users to sign scripts and enable Windows PowerShell to recognize signed and unsigned scripts and to determine whether the scripts originate on the Internet.
The Windows PowerShell Certificate provider lets you navigate the Certificate namespace and view the Certificate stores and Certificates. It also lets you copy, move, and delete Certificates and Certificate stores, and it lets you open the Certificates snap-in for the Microsoft Management Console (MMC).
The Certificate provider exposes the Certificate namespace as the Cert: drive in Windows PowerShell. The Cert: drive has the following three levels:
— Store locations (Microsoft.PowerShell.Commands.X509StoreLocation), which are high-level containers that group the Certificates for the current user and for all users. Each system has a CurrentUser and LocalMachine (all users) store location.
— Certificates stores (System.Security.Cryptography.X509Certificates.X509Store), which are physical stores in which Certificates are saved and managed.
— X.509 Certificates (System.Security.Cryptography.X509Certificates.X509Certificate2), each of which represent an X.509 Certificate on the computer. Certificates are identified by their thumbprints.
The Windows PowerShell Certificate provider supports the Set-Location, Get-Location, Get-Item, Get-ChildItem, and Invoke-Item cmdlets.
In addition, the Windows PowerShell Security snap-in (Microsoft.PowerShell.Security), which includes the Certificate provider, also includes snap-ins to get and set Authenticode signatures and to get Certificates. For a list of cmdlets in the Security snap-in, type “Get-Command -module *security”.
CAPABILITIES
TASKS
TASK: Navigating the Cert: Drive
————————– EXAMPLE 1 ————————–
This command uses the Set-Location cmdlet to change the current location to the Cert: drive.
Set-Location cert:
————————– EXAMPLE 2 ————————–
This command uses the Set-Location command to change the current location to the Root Certificate store in the LocalMachine store location. Use a backslash (\) or a forward slash (/) to indicate a level of the Cert: drive.
Set-Location -path LocalMachine\Root
If you are not in the Cert: drive, begin the path with the drive name.
TASK: Displaying the Contents of the Cert: Drive
————————– EXAMPLE 1 ————————–
This command uses the Get-ChildItem cmdlet to display the Certificate stores in the CurrentUser Certificate store location.
Get-ChildItem -path cert:\CurrentUser
If you are in the Cert: drive, you can omit the drive name.
————————– EXAMPLE 2 ————————–
This command uses the Get-ChildItem cmdlet to display the Certificates in the My Certificate store.
Get-ChildItem -path cert:\CurrentUser\My
If you are in the Cert: drive, you can omit the drive name.
————————– EXAMPLE 3 ————————–
This command uses the Get-Item cmdlet to get the “My” Certificate store and the Property parameter of Format-List with a wildcard character (*) to display all of the properties of the store.
Get-Item -path cert:\CurrentUser\My | Format-List *
————————– EXAMPLE 4 ————————–
This command gets a Certificate and displays all of its properties. It uses the Get-ChildItem cmdlet to get the Certificate and the Property parameter of Format-List with a wildcard character (*) to display all of the properties of the Certificate.
The Certificate is identified by its thumbprint.
Get-ChildItem -path cert:\CurrentUser\my\6B8223358119BB08840DEE50FD8AF9EA776CE66B | Format-List -property *
————————– EXAMPLE 5 ————————–
This command uses the Get-ChildItem cmdlet to get all of the Certificates on the computer and its CodeSigningCert dynamic parameter to get only the Certificates that have code-signing authority.
Get-ChildItem -path * -codesigningcert -recurse
TASK: Opening the Certificates MMC Snap-in
————————– EXAMPLE 1 ————————–
This command opens the Certificates MMC snap-in to manage the specified Certificate.
invoke item cert:\CurrentUser\my\6B8223358119BB08840DEE50FD8AF9EA776CE66B
DYNAMIC PARAMETERS
-CodeSigningCert <System.Management.Automation.SwitchParameter>
Gets only those Certificates with code-signing authority.
Cmdlets Supported: Get-Item, Get-ChildItem
NOTES
RELATED LINKS
about_providers
about_Signing
Get-AuthenticodeSignature
Set-AuthenticodeSignature
Get-PfxCertificate