Use Powershell To Set Custom Roles on View and Edit

Use Powershell To Set Custom Roles on View and Edit

avatar

I'm trying to figure out how to use the PowerShell Module to set Custom Roles on View and Edit permissions for Individual sessions.

I can set the RoleOverride to Custom using the Set-RDMSessionProperty $RDMID -Path Security -Property RoleOverride -Value Custom

However, I can't seem to find a way to set the actual Permissions for View and Edit to Custom and assign Roles to them.

Anyone have any Ideas? Looking through the documentation I'm not finding anything that seems like it's going to do this, but I'm hoping I'm just missing something.

All Comments (1)

avatar

Hello,

To set the View permission, you have to set the ViewOverride property to Custom and set the ViewRoles with the list of roles or users. And to set other permissions like Add, Edit or Delete, you must set the Permissions property with an array of Devolutions.RemoteDesktopManager.Business.ConnectionPermission objects.

Here is a sample script :

$entry = Get-RDMSession -Name "TestPermissions"

# Set the View Permission
$view = @()
$view += "HelpDesk"
$view += "ServiceDesk"
$entry.Security.ViewOverride = "Custom"
$entry.Security.ViewRoles = $view

# Set the Add and Edit Permission
$perms = @()
$edit = New-Object Devolutions.RemoteDesktopManager.Business.ConnectionPermission
$edit.Override = "Custom"
$edit.Right = "Edit"
$edit.RoleValues = "HelpDesk, ServiceDesk"
$perms += $edit

$add = New-Object Devolutions.RemoteDesktopManager.Business.ConnectionPermission
$add.Override = "Custom"
$add.Right = "Add"
$add.RoleValues = "ServiceDesk"
$perms += $add

$entry.Security.RoleOverride = "Custom"
$entry.Security.Permissions = $perms
Set-RDMSession $entry -Refresh

Érica Poirier