Forum / Remote Desktop Manager - PowerShell Repository

PowerShell script to remove Security Groups and set View Permission on folders

  • Create an Issue
  • Cancel

Hello,

The following script sample can be use to remove a Security Group on folders and replace it with View permission for specific roles.

Security Group to remove : MySecGrp
Roles to allow View Permission : DOWNHILL\Help Desk, DOWNHILL\Service Desk

$sgrp = Get-RDMSecurityGroup -Name "MySecGrp"

$sessions = Get-RDMSession | where {$_.SecurityGroup -eq $sgrp.ID}

foreach ($sess in $sessions)
{
# Remove the Security Group
$sess.SecurityGroup = '00000000-0000-0000-0000-000000000000'

# Set the View Permission
$view = @()
$view += "DOWNHILL\Help Desk"
$view += "DOWNHILL\Service Desk"
$sess.Security.ViewOverride = "Custom"
$sess.Security.ViewRoles = $view
$sess.Security.RoleOverride = "Custom"

Set-RDMSession $sess -Refresh
}
Update-RDMUI

Best regards,



Érica Poirier

Happy Holiday Season!
Although our various support queues will be monitored during the coming holiday season, Devolutions' offices will be closed from December 24th, 2019, to January 1, 2020, inclusively.

signaturesignature

Clock2 yrs