Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Active Directory User scripting from MIS data without CNs


Recommended Posts

Posted

The new DS* commands in Windows 2003 (DSAdd, DSMod etc) are great by they rely on referring to users by common names (CNs). I guess it's because users are just one other AD object type.

 

My problem is that I like to operate on users wherever OU they are rather than specifying the full CN. For students I can normally derive the username from MIS data but CNs are suceptible to changes in spelling or movements in teaching/tutor groups.

 

Any ideas? Should I DSQuery to get the CNs then match to the username field and then peform the DSMod with CN?

Posted

Using ADSI scripting you can pull an object from AD with two methods using the LDAP provider or the WinNT.

 

With the LDAP you have to specify the full CN eg

 

GetObject("LDAP://cn=blah,cn=blah")

 

But with the WinNT you can use a simpler format eg:

 

Set ObjUser = GetObject("WinNT://yourdomain/username","user")

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...