Page 1 of 1 1
Topic Options
#203448 - 2011-11-04 12:38 PM Configure a user in Active directory
rohm Offline
Fresh Scripter

Registered: 2002-07-11
Posts: 7
hi,

is it possible to create a kix-script to configure the fields in active directory?

For example i have an existing user and i want to change some user-rights or the email-adress and some other fields of the active directory like the phone number...

frank

Top
#203449 - 2011-11-04 01:44 PM Re: Configure a user in Active directory [Re: rohm]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Yes, it certainly is. Search for COM and ADSI for many examples.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#203452 - 2011-11-04 06:08 PM Re: Configure a user in Active directory [Re: Les]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Specifically, the ADSIUserInfo() UDF allows you to get/set any AD attribute.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#203457 - 2011-11-06 12:09 PM Re: Configure a user in Active directory [Re: Glenn Barnas]
rohm Offline
Fresh Scripter

Registered: 2002-07-11
Posts: 7
Thank you for your replies.
Glenn i have written a test-script integrating your udf-example but it doesn´t work. where could be the mistake?

when i am testing it the result will be:

result: ADSIUserInfo()



this is a cuttet example of the script:

$test="ADSIUserInfo()"
?"result: $test"

;;
;;======================================================================
;;
;;FUNCTION ADSIUserInfo()
;;
;;ACTION Get or Set a user attribute via ADSI
;;
;;AUTHOR Glenn Barnas
.
.
.
If Not $_AValid Exit 87 EndIf ; no valid values
EndIf

Exit @ERROR


EndFunction

thank you for your answer

Frank

Top
#203458 - 2011-11-06 03:11 PM Re: Configure a user in Active directory [Re: rohm]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4563
Loc: USA
Please see the FAQ...

How to use UDFs -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943

Top
#203500 - 2011-11-07 03:09 PM Re: Configure a user in Active directory [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
The following works:
 Code:
'Result - UserDN: ' ADSIUserInfo() @CRLF
; entire ADSIUserInfo UDF inserted here...
This displays the userDN string for the current user. You then use this DN string (or adapt it for another similar user) to query or set the additional attributes. The UserName must be in the UserDN format.

The UDF is typically called without args to obtain a UserDN, and then called with the UserDN to query or define the attribute.

Make sure you include the entire UDF, unmodified, somewhere in your script. Most of us place UDFs at the end of the script, or use CALL statements to load them at the beginning. I prefer to embed the UDFs at the end since they will always be available and "frozen" in a working configuration. Using external UDFs can cause an app to break when a UDF is updated and all dependent scripts aren't tested.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1538 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.059 seconds in which 0.028 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org