Hi,
Thanks for the reply.
As I've actually asked two different questions, but they do seem to have a cross-over, I've split my feedback below into three to hopefully make my explanation\questions easier to understand!
=== Working With Multi-Value Attributes ===
As you stated:
"On user deprovisioning, you can use a PowerShell script that would find all the objects managed by the user"
some attributes for users hold multiple values - such as 'ManagedObjects'.
I was therefore wondering whether there was any easy way of using the Adaxes GUI workflows to return ALL ManagedObjects values for a user account, or if we have to use a script for this (I guess using some form of 'For Each' loop)?
=== Querying Custom Adaxes Attributes In PowerShell Scripts ===
The script I included above to email the manager name etc was a test script that I was using to validate that I could lookup an attribute for the manger of a user account being processed in a powershell script.
Using email to send the results was really just a simple way to validate that an attribute was being returned correctly, so the important bits were really:-
# Bind to the Manager of the employee account
$managerDN = $Context.TargetObject.Manager
# Return an attribute of the manager account
$Context.SendMail("bob@bob.com", $subject, $manager.Fullname, $bodyHtml)
and what I really want to be able to do is return a custom attribute:-
# Return the custom adaxes attribute 'Account Status' of the manager account
$Context.SendMail("bob@bob.com", $subject, $manager.AccountStatus, $bodyHtml)
where, the queried value is either the customattributetextxx name or friendly name of a custom attribute, and would ultimately be used in the script to do something else i.e.
If ($manager.AccountStatus -neq 'Active')
{what to do when manager is not available}
Else
{start standard review process}
The context for this question was; we currently add a custom attribute for each user account "Account Status" that can have values of 'Active' if the user account is active, 'Maternity' if they are on maternity leave, 'Extended Leave' if they are on extended leave etc.
Therefore, when we are about to start the automated account reviews, we know that, if the Manager account status is anything other than Active, they will not be available to respond. In this case we need to have an alternate process to follow as the emails will be bing sent to someone not available to respond. This could be i) use the manager's manger, ii) use the manager's defined alternate (deputy), or iii) something else etc.
During my tests using the above script/syntax I can return any standard AD attributes, but was unable to query custom attributes as they always came back blank?
=== Putting some of the above concepts together - Replacing a Mangers repoting line objects to stop reporting line orphans being created during object deletions ===
I'm not yet sure exactly how we want this to work in practise, but I think our objective is going to be something like this:-
-
When deprovisioning a user, check to see whether they have any 'Direct Reports' and/or 'Managed Objects'
If so, send an email to Security Team listing all of the supplicant objects and stop the account being removed until they have been reassigned.
Reassign each link manually, or use a custom form (as per your suggestion) and a Business Rule that allows the Security Team to provide an alternate 'Manager' value that will then be used to replace all references to the old account automatically.
When all reporting lines to the old account have been removed, allow deprovisioning to proceed.
So this script\s run by the Business Rule would be something like (apologies for badly summarised script syntax!):
# Replace reporting line logic - run against all AD objects
For each $User
{
If (Context.TargetObject.ManagedBy' -eq $UserToBeDeleted)
{Set Context.TargetObject.ManagedBy = $UserToBeDeleted.Replacement}
}
# Replace owned objects logic - run against deprovisioned account itself
For each $Context.TargetObject.ManagedObject
{
Bind to ManagedObject and change owner to Context.TargetObject.Replacement
}
===
Regards