Get-Context¶
SYNOPSIS¶
Retrieves a context from the context vault.
SYNTAX¶
__AllParameterSets¶
Get-Context [[-ID] <string[]>] [[-Vault] <string[]>] [<CommonParameters>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
Retrieves a context by reading and decrypting context files directly from the vault directory. If no ID is specified, all available contexts will be returned. Wildcards are supported to match multiple contexts.
EXAMPLES¶
EXAMPLE 1¶
Get-Context
Output:
Repositories : {@{Languages=System.Object[]; IsPrivate=False; Stars=130;
CreatedDate=2/9/2024 10:45:11 AM; Name=Repo2}}
AccessScopes : {repo, user, gist, admin:org}
AuthToken : MyFirstSuperSecretToken
TwoFactorMethods : {TOTP, SMS}
IsTwoFactorAuth : True
ApiRateLimits : @{ResetTime=2/9/2025 11:15:11 AM; Remaining=4985; Limit=5000}
UserPreferences : @{CodeReview=System.Object[]; Notifications=; Theme=dark; DefaultBranch=main}
SessionMetaData : @{Device=Windows-PC; Location=; BrowserInfo=; SessionID=sess_abc123}
LastLoginAttempts : {@{Success=True; Timestamp=2/9/2025 9:45:11 AM; IP=192.168.1.101}, @{Success=False}}
ID : GitHub/User-3
Username : john_doe
LoginTime : 2/9/2025 10:45:11 AM
Repositories : {@{Languages=System.Object[]; IsPrivate=False; Stars=130;
CreatedDate=2/9/2024 10:45:11 AM; Name=Repo2}}
AccessScopes : {repo, user, gist, admin:org}
AuthToken : MySuperSecretToken
TwoFactorMethods : {TOTP, SMS}
IsTwoFactorAuth : True
ApiRateLimits : @{ResetTime=2/9/2025 11:15:11 AM; Remaining=4985; Limit=5000}
UserPreferences : @{CodeReview=System.Object[]; Notifications=; Theme=dark; DefaultBranch=main}
SessionMetaData : @{Device=Windows-PC; Location=; BrowserInfo=; SessionID=sess_abc123}
LastLoginAttempts : {@{Success=True; Timestamp=2/9/2025 9:45:11 AM; IP=192.168.1.101}, @{Success=False}}
ID : GitHub/User-8
Username : jane_doe
LoginTime : 2/9/2025 10:45:11 AM
Retrieves all contexts from the context vault (directly from disk).
EXAMPLE 2¶
Get-Context -Vault 'MyModule'
Retrieves all contexts from the 'MyModule' vault.
EXAMPLE 3¶
Get-Context -ID 'MySecret' -Vault 'MyModule'
Retrieves the context called 'MySecret' from the 'MyModule' vault.
EXAMPLE 4¶
'My*' | Get-Context -Vault 'MyModule'
Output:
ID : MyConfig
Config : {ConfigKey=ConfigValue}
ID : MySecret
Key : EncryptedValue
AuthToken : EncryptedToken
Favorite : {Color=Blue; Number=7}
ID : MySettings
Setting : {SettingKey=SettingValue}
Config : {ConfigKey=ConfigValue}
YourData : {DataKey=DataValue}
Retrieves all contexts that start with 'My' from the context vault (directly from disk).
PARAMETERS¶
-ID¶
The name of the context to retrieve from the vault. Supports wildcards.
Type: System.String[]
DefaultValue: '*'
SupportsWildcards: true
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: false
ValueFromPipeline: true
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Vault¶
The name of the vault to store the context in.
Type: System.String[]
DefaultValue: '*'
SupportsWildcards: true
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
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¶
System.String[]¶
{{ Fill in the Description }}
OUTPUTS¶
[System.Object]¶
{{ Fill in the Description }}
System.Object¶
{{ Fill in the Description }}
NOTES¶
Returns a list of contexts matching the specified ID or all contexts if no ID is specified. Each context object contains its ID and corresponding stored properties.