Creating Context-Menu-Entries

New userdefined Context-Menu-Entries are created through using the New-EmdbUITask cmdlet. The mandatory parameters are a name, the object-class for which the Context-Menu-Entry is valid and the command to be executed.


Examples:


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


The following example creates a new userdefined Context-Menu-Entry named "Ping". The task is valid for Computer-objects and the command to be executed is "%WINSYSDIR%\ping.exe %CurrentComputer.Object.Name%.


New-EmdbUITask "Ping" -RegisteredForSchemaTag "Computer" -Command "%WINSYSDIR%\ping.exe" -Arguments "%CurrentComputer.Object.Name%"


Note: According to the creation of Context-Menu-Entries in the DSMC, the prefix "Custom_" is automatically added to the name. This can be circumvented through using the -NoCustomPrefix switch. However, it is strongly recommended to not using this switch and stick to the standard behaviour.


In order to create a Context-Menu-Entry in a Context-Menu-Group, the TaskGroup parameter must be supplied. The display name can be set using the -DisplayName switch. The code below completes the example from above accordingly:


$MyTaskGroup = Get-EmdbUITaskGroup "Custom_Computermanagement"

New-EmdbUITask "Ping" -Displayname "Ping..." -RegisteredForSchemaTag "Computer" -TaskGroup $MyTaskGroup -Command "%WINSYSDIR%\ping.exe" -Arguments "%CurrentComputer.Object.Name%"


If you are working in an international environment, the display names for the different languages supported by DSM 2014.1 can be specified. To achieve this, you supply a hash-table as the value of the DisplayName-switch, where each element consists of the combination <culturecode>=<displayname> and the elements are separated by semicolons.


New-EmdbUITask "RemoteControl" -DisplayName @{de="Fernsteuerung";en="Remote Control"} -RegisteredForSchemaTag "Computer" -Command "%ProgramFilesDir%\radmin.exe" -Arguments "%CurrentComputer.Object.Name%"


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.