I'm trying to update the AD manager field using PS. We we're given a CSV file from HR with everyone's manager info. This is PS script.
Import-Module ActiveDirectory
$Users = Import-Csv "C:\Users\Administrator.APC-SERVICES\Desktop\mngimport\Managers1.csv"
ForEach ($User in $User)
{
$ADUser = Get-ADUser -Filter "displayname -eq '$($User.ProfessionalFullName)'"
$manager = (Get-ADUser -Filter "displayname -eq
'$($User.'ManagerFullName')'").distinguishedname
if ($ADUser -and $manager) {
Set-ADUser -Identity $ADUser -Replace @{manager = $manager }
}
}
Nothing happens after running this. I keep checking the AD Users and the Manager attribute does not update. What am i missing?
CSV format:
ProfessionalFullName,ManagerFullName
Greg Brown,Jay Smith
Jesus Lopez ,Jay Smith
Stephen Jones,Jay Smith
Scott Williams ,Roy Miller
Jason Davis,Roy Miller
Starting with version 5.0.7.9 and above of AD Bulk Users you can set a users manager value using the managers username, distinguishedName or the managers employeeID. Internally in Active Directory a users Manager (seen on the Organization tab) is stored using the managers distinguishedName, although you are shown the managers cn value.
When setting manager attribute we need to provide the distinguishedName or the manager, for example:
CN=James Blunt,OU=Managers,DC=Domain,DC=ComWith AD Bulk Users version 5.0.7.9 and later the program can *search Active Directory for the manager’s distinguishedName if your provide the managers sAMAccountName (username of the manger) or the manager’s employeeID value.
Below are three example CSV files that would set a users manager value.
Using the managers sAMAccountName (username)
sAMAccountName,Modify,manager pjones,True,jbluntUsing the managers employeeID
sAMAccountName,Modify,manager pjones,True,123987Using the manager’s distinguishedName
sAMAccountName,Modify,manager pjones,True,"CN=James Blunt,OU=Managers,DC=Domain,DC=Com"*Using the sAMAccountName or employeeID will be slower than using the distinguishedName as the program will need to query Active Directory for the managers distinguishedName value.
Platform Notice: Data Center Only - This article only applies to
Atlassian products on the data center platform. Users from Active Directory (AD) are imported into Insight as objects correctly but without Manager attribute by default. This KB is to explain how to map the Manager
attribute as an Insight object as well as a Jira user. An AD user, Maurice Moss has a manager, Jen Barber. Both of them are imported into Insight as an object using predefined structure and configuration. However, Jen is not associated with Maurice as his manager in the object. The expected outcome is to have Jen shown as Maurice's manager as an Insight object, or Jen's Jira user profile in the manager attribute.
Scenario 1 - Import manager attribute as an Insight object In the import configuration, locate the object type mapping for the AD users and map the data locator "manager" with the attribute created from the previous step. An IQL is needed as the attribute is referencing to another object. If you are using predefined
configuration, you may use the IQL below as it is. distinguishedName = ${manager} Run a synchronization and verify if the Manager attribute is populated with the right manager object.Purpose
Example
Solution
Scenario 2 - Import manager attribute as Jira user
- In the object type which AD users are imported into, add a new attribute for Manager with type
User.
- In the import configuration, locate the object type mapping for the AD users and map the data locator "manager" with the attribute created from the previous
step.
After adding the attribute mapping, edit the row by clicking on the gear icon on the far right > Configure. Add the following to the Regular expression field and click Update.
- Run a synchronization and verify if the Manager attribute is populated with the right Jira user.
Troubleshooting
If the manager attribute is not populated with either or both the solution above, perform the steps below and contact support if needed.
- Add another attribute to get the text value of the imported manager data.
- In the import configuration, map the attribute with the data locator "manager".
- Run a synchronization and verify if the new manager attribute is populated. An expected value is the full DN of the manager which looks like CN=Jen Barber,OU=Employees,DC=michin,DC=internal .
- Verify if the user object that is expected to be shown as the manager has the identical DN in the distinguishedName attribute.
Last modified on Apr 5, 2022
Related content
- No related content found