#31147 - 2002-10-21 08:23 PM
Re: Reading Active Directory Attribute
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
In your script what does this yield? code:
$OfficeName = $UserObj.physicalDeliveryOfficeName ? "@error @serror" ? $OfficeName
{edit} This assumes that you have already got the $UserObj by ADSI. [ 21. October 2002, 20:25: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#31149 - 2002-10-21 08:36 PM
Re: Reading Active Directory Attribute
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
There are many examples of using ADSI in KiXtart. Check out the Scripts forum, COM forum, and the UDF Library for examples.
Download the ADSI documetation from Active Directory Service Interfaces Overview Here is a little script to get you started. code:
break on
; ; This script determines the fully qualified distinguished name ; of the current user, then directly binds to active directory ; and queries the name of it's parent container (OU) ... ; ; Requirements: KiXtart 3.63 & Windows 2000 /w Active Directory ;
; Instantiate active directory system info ...
$sysinfo = CreateObject("adsysteminfo") if vartypename($sysinfo)='object'
; Get user's distinguished name (DN) ... $username = $sysinfo.username
?"ADsPath = $username"
; Bind directly to user's active directory object ... $user = GetObject("LDAP://" + $username)
if vartypename($user)='object'
; Get the path of the parent container ... $parentpath = $user.parent
; Get the parent ... $parent = GetObject($parentpath)
if vartypename($parent)='object' $ou = $parent.name
?"OrganizationalUnit = $ou" else ? "Error creating parent object: @error @serror" endif else ? "Error creating user object: @error @serror" endif else ? "Error creating adsysteminfo object: @error @serror" endif exit
[ 21. October 2002, 20:38: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#31154 - 2002-10-21 11:42 PM
Re: Reading Active Directory Attribute
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
You have two choices (WinNT:// or LDAP://) provider.
$UserObj = GetObject("WinNT://@Ldomain/@userID,user")
or
$UserObj = GetObject("LDAP://@Ldomain/$ADsPath")
I show you how to get $ADsPath in the script in my previous post above.
{edit} You may have to use LDAP to get extended AD attributes/properties. WinNT:// is quite limited. [ 21. October 2002, 23:44: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 764 anonymous users online.
|
|
|