Removing Variables

Userdefined Variables are deleted using the Remove-EmdbVariable cmdlet or by using the object's Delete()-method. 


Examples:


Hint: The execution of these examples requires a connected PowerShell drive.


The following command deletes the userdefined Variable "InternalID" by using the Remove-EmdbVariable cmdlet:


Remove-EmdbVariable "InternalID"


The code below first retrieves the userdefined Variable "InternalID" and deletes the object subsequently:


$MyVariable = Get-EmdbVariable "InternalID"

$MyVariable.Delete()


In order to delete all userdefined Variables, the code shown below can be used, for example:


Get-EmdbVariable | Where-Object {$_.IsSystem -eq $false} | ForEach-Object {$_.Delete()}


Note: As long a a Variable has values assigned, it cannot be deleted. You have to delete all associated Variable-assignments first, as described here.


Note: Note that Variable-Groups are not part of the context rootDSE and therefore they can be referenced without a full qualified path resp. an absolute path.