February 2019
Intermediate to advanced
626 pages
15h 51m
English
As the name suggests, the Remove variable destroys a variable and any data it may hold.
The Remove variable is used as follows:
$psProcesses = Get-Process powershell Remove-Variable psProcesses
If more than one variable refers to an object, the object won't be removed. For example, the following command shows the name of the first process running (conhost.exe, in this particular case):
PS> $object1 = $object2 = Get-Process | Select-Object -First 1PS> Remove-Variable object1PS> Write-Host $object2.Nameconhost
Read now
Unlock full access