Retrieving Context-Menu-Entries

In order to retrieve userdefined Context-Menu-Entries, the cmdlet Get-EmdbUITask is used.


Examples:


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


The following example retrieves all userdefined Context-Menu-Entry objects. Please be aware that system-objects that are part of a DSM 2014.1 installation, as for example the Context-Menu-Entries for Virtualization-specific commands, will be part of the resultset


Get-EmdbUITask


If you just want to retrieve Context-Menu-Entires not having set the "IsSystem"-Flag, that is, Context-Menu-Entries created by you, you can get these using the following command:


Get-EmdbUITask | Where-Object {$_.IsSystem -eq $false}


In order to retrieve just one specific Context-Menu-Entry, for example "Ping...", and save this object in a variable, you can use the following code-snippet:e:


$MyUITask = Get-EmdbUITask "Custom_Ping..."


Retrieve the Context-Menu-Entry "Shutdown..." through its Item-ID (this ID will vary in different DSM environments):


Get-EmdbUITask -ItemID 788


Tip: the alias ID can be used instead of ItemID.


Note: Note that Context-Menu-Entry 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 retrieving Context-Menu-Entry objects. When specifying the SingleItemExpected-switch it is expected, that none or exactly one object is contained in the result. If the retrieval returns more than one object, an error is raised that can be caught and handled in scripts.