Removing Context-Menu-Entries

Userdefined Context-Menu-Entries are deleted using the cmdlet Remove-EmdbUITask or by invoking the object's Delete()-method.


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

The following example deletes the userdefined Context-Menu-Entry "Custom_Ping" by using the Remove-EmdbUITask cmdlet:

Remove-EmdbUITask "Custom_Ping"

Alternatively, the following code snippet first retrieves the object associated with the userdefined Context-Menu-Entry "Custom_Ping" and deletes it subsequently by using the object's Delete()-method:

$MyUITask = Get-EmdbUITask "Custom_Ping"


In order to delete all userdefined Context-Menu-Entries, the code shown below can be used, for example:

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

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

Starting with PSX 3.1 there was a new option implemented when deleting Context-Menu-Entry objects. When specifying the SingleItemExpected-switch it is expected, that none or exactly one object is affected. If the command would delete more than one object, an error is raised that can be caught and handled in scripts.