Contact Info

Crumbtrail » Administration » Powershell » Powershell 1.0 » Remove-Variable

Remove-Variable - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »


Remove a variable and its value

Remove-Variable [[-Name] String[] ]
         [-Include string] [-Exclude string] 
            [-scope string] [-force] [-whatIf]
               [-confirm] [CommonParameters]

       The name of the variable(s) to be removed.

   -include string
       Delete only the specified items.
       Wildcards are permitted.

   -exclude string
       Omit the specified items. Wildcards are permitted.
       Get only the value of the variable.

   -scope string
       The scope in which this alias is valid. 
       Valid values are "Global", "Local", "Private" or "Script", or a number 
       relative to the current scope ( 0 through the number of scopes, where 
       0 is the current scope and 1 is its parent). "Local" is the default.
       For more, type "get-help about_scope".

       Override restrictions that prevent the command from succeeding, apart
       from security settings. e.g. -force will override a files read-only
       attribute, but will not change file permissions.

       Describe what would happen if you executed the command without
       actually executing the command.

       Prompt for confirmation before executing the command.

       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

Remove an existing variable $myvar:

PS C:\>remove-variable myvar