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

signaturesignature

Clock2 yrs