Hello Chris,
If you prefer using the Employee Type property, we suggest the following solution: you need to create a Business Rule that will trigger before creating a user and check the user's Manager property. If this property is not empty, the Business Rule will then check the manager's employeeType property. If this property equals Contractors, then the Business Rule will cancel the user creation operation. All checking operations will be performed by a PowerShell script.
To create such a Business Rule, follow these steps:
-
Create a new Business Rule.
-
On the 2nd step of the Business Rule creation wizard, select User and Launch this Rule before Creating a User.
-
On the 3rd step of the wizard, add the Cancel this operation action and click OK.
-
Click Always.
-
Add the If PowerShell script returns true condition.
-
Paste the following script:
# The condition is met if $Context.ConditionIsMet is set to $True.
$Context.ConditionIsMet = $False;
if ($Context.IsPropertyModified("manager"))
{
$manager = $Context.BindToObjectByDN("%manager%")
try
{
$managerType = $manager.Get("employeeType")
}
catch
{
return
}
if ($managerType -eq "Contractor")
{
$Context.ConditionIsMet = $True
}
}
-
Finish creation of the Business Rule following instructions of the wizard.
If you would rather prefer placing contractors in a separate OU, you will need another script. We can write it, if you want.