Share via


PSVariableIntrinsics.Remove Method

Definition

Overloads

Remove(PSVariable)

Removes the specified variable from session state.

Remove(String)

Removes the specified variable from session state.

Remove(PSVariable)

Removes the specified variable from session state.

public:
 void Remove(System::Management::Automation::PSVariable ^ variable);
public void Remove (System.Management.Automation.PSVariable variable);
member this.Remove : System.Management.Automation.PSVariable -> unit
Public Sub Remove (variable As PSVariable)

Parameters

variable
PSVariable

The variable to be removed. It is removed based on the name of the variable.

Exceptions

If variable is null.

if the variable is constant.

Applies to

Remove(String)

Removes the specified variable from session state.

public:
 void Remove(System::String ^ name);
public:
 void Remove(Platform::String ^ name);
void Remove(std::wstring const & name);
public void Remove (string name);
member this.Remove : string -> unit
Public Sub Remove (name As String)

Parameters

name
String

The name of the variable to be removed. The name can contain drive and/or scope specifiers like "ENV:path" or "global:myvar".

Exceptions

If name is null.

if the variable is constant.

If the name refers to a provider that could not be found.

If the name refers to a drive that could not be found.

If the provider that the name refers to does not support this operation.

If the provider threw an exception.

Applies to