'Beanshell parse exception
I'm working in the following rule we created to add it to a task and run daily to remove all groups from users in the "Tango" OU in AD but the Domain Users group.
The powershell command works perfect but when we try tu run this rule we get the parse error.
Would you please help me find out what is it failing?
Thank you!
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule created="1649362804184" id="2c90a0a28005280e018005af1dd804e2" language="beanshell" modified="1649366068717" name="SCH-RunPS-Test">
<Attributes>
<Map>
<entry key="ObjectOrientedScript" value="true"/>
<entry key="disabled" value="false"/>
<entry key="extension" value=".ps1"/>
<entry key="program" value="powershell.exe"/>
<entry key="timeout" value="60"/>
</Map>
</Attributes>
<Description>SCH - Run PS Test</Description>
<Source>
Param (
[string]$OU = "OU=Tango,OU=People,DC=Lab,DC=Dev",
$Confirm = $True
)
$contador = 0
$ExceptGroup = "Domain Users"
Import-Module ActiveDirectory
Write-Host Organizational Unit: $OU
Write-Host Confirm: $Confirm
$users = Get-ADUser -SearchBase $OU -Filter *
foreach ($user in $users) {
$UserDN = $user.DistinguishedName
Get-ADGroup -LDAPFilter "(member=$UserDN)" | foreach-object {
if ($_.name -ne $ExceptGroup) {
$contador = $contador + 1
}
}
}
Write-Host Conteo: $contador
</Source>
</Rule>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
