Skip to content

Remove-Context

SYNOPSIS

Remove a context from the context vault.

SYNTAX

Remove-Context [[-Name] <String>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
 [<CommonParameters>]

DESCRIPTION

This function removes a context from the vault. It supports removing a single context by name, multiple contexts using wildcard patterns, and can also accept input from the pipeline. If the specified context(s) exist, they will be removed from the vault.

EXAMPLES

EXAMPLE 1

Remove-Context

Removes all contexts from the vault.

EXAMPLE 2

Remove-Context -Name 'MySecret'

Removes the context called 'MySecret' from the vault.

EXAMPLE 3

Remove-Context -Name 'MySe*'

Removes the context called 'MySecret' from the vault.

EXAMPLE 4

'MySecret*' | Remove-Context

Removes all contexts matching the pattern 'MySecret*' from the vault.

EXAMPLE 5

Get-Context -Name 'MySecret*' | Remove-Context

Retrieves all contexts matching the pattern 'MySecret*' and removes them from the vault.

PARAMETERS

-Name

The name of the context to remove from the vault. Supports wildcard patterns.

Type: String
Parameter Sets: (All)
Aliases: Context, ContextName

Required: False
Position: 1
Default value: *
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: True

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

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

INPUTS

OUTPUTS

System.Void

NOTES