Retrieving Context-Menu-Groups

In order to retrieve userdefined Context-Menu-Groups, the cmdlet Get-EmdbUITaskGroup is used.


Examples:


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


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


Get-EmdbUITaskGroup


DSM 2014.1 names all Context-Menu-Groups that are created by a DSM 2014.1 administrator internally with the prefix "Custom_". As a consequence, all Context-Menu-Groups that are modifiable by you can bei retrieved using the following command:


Get-EmdbUITaskGroup "Custom_*"


Alternatively you can just filter all groups from the pipeline that have not set the "IsSystem"-Flag:


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


Finally, for just retrieving the Context-Menu-Group "Computermanagement" and save this object in a variable, you can use the following code:


$MyUITaskGroup = Get-EmdbUITaskGroup "Custom_Computermanagement"


Retrieve the Context-Menu-Group "Citrix-Management" through its Item-ID (this ID will vary in different DSM environments):


Get-EmdbUITaskGroup -ItemID 123


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


Note: Note that Context-Menu-Group 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-Group 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.