How to add custom attribute generation to new user creation with Web Portal
Summary: When creating a new user account with Cayosoft AdministratorWeb Portal, attributes can be automatically generated using Attribute Policy, Generated value setting. In some cases, the functionality of Attribute Policy is not enough, and a custom PowerShell code should be used to generate a value for the target attribute, based on value of one or more source attributes.
In this case, an instance of the AD Users | Set Attribute Value rule is created and linked to the New User command as a rule to run after.
Applies to: Cayosoft Administrator 5.3 or later.
Example
As an example, we would generate the mS-DS-ConsistencyGuid attribute (target attribute), by copying the value of created ObjectGUID (source attribute).
Step 1: Create rule AD Users | Set Attribute Value to set target attribute value
Complete the following fields:
Limit scope to Domain or OU: User created in Web Portal
Query Criteria: ObjectGUID of User Created in Web Portal
Returned properties:
Name,DistinguishedName,SamAccountName,UserPrincipalName,WhenCreated,<comma-separated list of source attributes>Example:
Name,DistinguishedName,SamAccountName,UserPrincipalName,WhenCreated,ObjectGUIDAttribute(s): <target attribute>
Example:
mS-DS-ConsistencyGuidValues:
<PowerShell code script block code in form of { ... code ... }.InvokeReturnAsIs()>Example: {$FoundObject.ObjectGUID}.InvokeReturnAsIs()
Step 2: Add created rule to New User web action, the Rules to Run After list
Step 3: Optionally specify a condition for when the rule should set the attribute value
Example
Execute If condition that checks the Other Attribute 1 value is set to Contractor or Intern values in the New User wizard:
((GetSessionParameter "CreatedObjectGUID") -ne $null) -and (($CustomAttr1 -eq 'Contractor') -or ($CustomAttr1 -eq 'Intern'))
Comments
0 comments
Please sign in to leave a comment.