Problem

The Identity Manager AD driver matches against eDir users on the basis of the userprincipalname. However, this is an optional attribute that not all users (especially ones created before Windows 2003) have.

Solution

Here’s a quick one-liner I whipped up in a few minutes for a customer. This will find all users in an Active Directory tree that don’t have a UserPrincipalName, get their SamAccountName, build a UPN off of that, and inject the new UPN’s into AD.

ldapsearch -xWZLLL -D "cn=Administrator,cn=users,dc=example,dc=com" -b
"dc=example,dc=com" -h myserver.example.com
'(&(objectclass=user)(!(userprincipalname=*)))' samaccountname | sed
'/sAMAccountName/s/$/\@example\.com/g' | sed
s/sAMAccountName/userPrincipalName/g | ldapmodify -xWZ -D
"cn=Administrator,cn=users,dc=example,dc=com" -h myserver.example.com
0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.
Loading...Loading...

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.

Leave a Reply

No Comments
Aug 16, 2006
12:00 am
Reads:
1,026
Score:
Unrated