Remove-Context¶
SYNOPSIS¶
Removes a context from the context vault.
SYNTAX¶
__AllParameterSets¶
Remove-Context [-ID] <string[]> [[-Vault] <string>] [-WhatIf] [-Confirm] [<CommonParameters>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
This function removes a context (or multiple contexts) from the vault. It supports: - Supply one or more IDs as strings (e.g. -ID 'Ctx1','Ctx2') - Supply objects that contain an ID property
The function accepts pipeline input for easier batch removal.
EXAMPLES¶
EXAMPLE 1¶
Remove-Context -ID 'MySecret' -Vault "MyModule"
Output:
Removing context [MySecret]
Removed item: MySecret
Removes a context called 'MySecret' from the "MyModule" vault by specifying its ID.
EXAMPLE 2¶
Remove-Context -ID 'Ctx1','Ctx2'
Output:
Removing context [Ctx1]
Removed item: Ctx1
Removing context [Ctx2]
Removed item: Ctx2
Removes two contexts, 'Ctx1' and 'Ctx2'.
EXAMPLE 3¶
'Ctx1','Ctx2' | Remove-Context
Output:
Removing context [Ctx1]
Removed item: Ctx1
Removing context [Ctx2]
Removed item: Ctx2
Removes two contexts, 'Ctx1' and 'Ctx2' via pipeline input.
EXAMPLE 4¶
$ctxList = @( [PSCustomObject]@{ ID = 'Ctx1' }, [PSCustomObject]@{ ID = 'Ctx2' } ) $ctxList | Remove-Context
Output:
Removing context [Ctx1]
Removed item: Ctx1
Removing context [Ctx2]
Removed item: Ctx2
Accepts pipeline input: multiple objects each having an ID property.
PARAMETERS¶
-Confirm¶
Prompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- cf
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-ID¶
One or more IDs as strings of the contexts to remove.
Type: System.String[]
DefaultValue: ''
SupportsWildcards: true
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: true
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Vault¶
The name of the vault to remove contexts from.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-WhatIf¶
Runs the command in a mode that only reports what would happen without performing the actions.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- wi
ParameterSets:
- Name: (All)
Position: Named
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.String]¶
{{ Fill in the Description }}
NOTES¶
Returns the name of each removed context if successful.