Get-SecretInfo
Finds and returns metadata information about secrets in registered vaults.
Syntax
Get-SecretInfo
[[-Name] <String>]
[[-Vault] <String>]
[<CommonParameters>]
Description
This cmdlet finds and returns information about secrets in registered vaults. By default, it returns information for every secret in all registered vaults.
Examples
Example 1
Get-SecretInfo -Name *
Name Type VaultName
---- ---- ---------
Secret1 String LocalStore
Secret2 ByteArray LocalStore
Secret3 SecureString LocalStore
Secret4 PSCredential LocalStore
Secret5 Hashtable LocalStore
Secret6 ByteArray CredMan
This example specifies the Name parameter as a single wildcard (*
) character to return
metadata for all stored secrets. There are two registered vaults, LocalStore
and CredMan
. There
are six SecretInformation objects returned from the two vaults.
The output objects every valid type a secret can be:
- ByteArray
- Hashtable
- PSCredential
- SecureString
- String
Example 2
Get-SecretInfo -Name SecretWithMetadata | Select-Object -ExpandProperty Metadata
Key Value
--- -----
Environment Development
Expiration 5/1/2022 12:00:00 AM
GroupNumber 7
This example retrieves the SecretWithMetadata
secret and displays its metadata. The entries in the
hashtable show every valid type metadata values can be:
- String
- DateTime
- Int
Parameters
-Name
Specifies the name of a secret. This cmdlet only gets metadata for secrets that have the specified name. Enter a name or name pattern. Wildcard characters are permitted.
If the Name parameter is not specified, this cmdlet returns the metadata for all stored secrets.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | True |
-Vault
Specifies the name of a vault to search for secret metadata. Wildcard characters are not permitted.
If the Vault parameter is not specified, this cmdlet searches for metadata in all registered vaults.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None
Outputs
Microsoft.PowerShell.SecretManagement.SecretInformation