Edit

Share via


Get-SecretInfo

Finds and returns metadata information about secrets in registered vaults.

Syntax

Default (Default)

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 isn't specified, this cmdlet returns the metadata for all stored secrets.

Parameter properties

Type:String
Default value:None
Supports wildcards:True
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Vault

Specifies the name of a vault to search for secret metadata. Wildcard characters aren't permitted.

If the Vault parameter isn't specified, this cmdlet searches for metadata in all registered vaults.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

Microsoft.PowerShell.SecretManagement.SecretInformation