I have the need to run a scheduled task that executes a PowerShell script to update the user criteria item on a rule-based group. I have a good start on the script, but wondered if any PowerShell wizzards could assist me. It's just taking me a long time to understand the adaxes interfaces, their methods and all that. Any help would be apprecaited.
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")
# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")
# Bind to the group
$groupDN = "%distinguishedName%"
$group = $service.OpenObject("Adaxes://$groupDN", $null, $null, 0)
# returns criteria
$rules = $group.MembershipRules
foreach($rule in $rules){
$criteria = $rule.GetCriteria()
<# Find the user criteria item in the array that is:
Add({employeeType -eq "Full-Time Employee" -or employeeType -eq "Part-Time Employee" -or employeeType -eq "Limited Term Employee" -or employeeType -eq "Intern"}).
and replace with:
Add({employeeType -eq "Full-Time Employee" -or employeeType -eq "Part-Time Employee" -or employeeType -eq "Limited Term Employee" -or employeeType -eq "Intern" -or employeeType -eq "Regular" -or employeeType -eq "Temporary" -or employeeType -eq "Seasonal" -or employeeType -eq "Elected" -or employeeType -eq "State"}).
#>
}