Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AD Environment Scripting 1

Status
Not open for further replies.

dyarwood

Programmer
Nov 3, 2003
1,483
GB
Hi all,

I've been given the task of loading new groups and users into AD via code (C#). I can add groups and users fine using the directoryservices library but I am having massive trouble getting the Environments tab populated. I have tried various things including using the TSUSEREXLib library but getting an invalid cast error. I am developing on a WinXP machine but have copied and registered the dll from a Win 2003 Server. Does anyone have any ideas on how to script the user Environment in AD?

Cheers

dyarwood
 
Nevermind. Sorted it. FYI the code I used was

TSUSEREXLib.IADsTSUserEx m_TsUser;
ActiveDs.IADsUser iADsUser = (ActiveDs.IADsUser)myChildDirectoryEntry.NativeObject;
m_TsUser = (TSUSEREXLib.IADsTSUserEx)iADsUser;

Oddly enough I tried this yesterday with no success but deleted and readded the reference to tsuserex.dll and it worked today.
 
Thats ok. I have done a fair bit of research on it and got C# code for this as don't think there is a lot out the on the web.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top