Hi, I have been playing around with adsi and ldap stuff for a day or so, I
have it working okay to a degree but I am having problems retrieving
additional attributes for a user object, such as Phone-Mobile-Primary or
Does anyone have some ASP (VBscript) script that will retrieve these things?
I have found lots of tutorials and examples on how to retrieve the simple
stuff like samAccountName.
as an example I have tried the following
<%= objUserWinNT.Get( "mobile" ) %>
which results in a 500 error with the message "The Active Directory property
cannot be found in the cache"
So I guess that I am trying to get a property with the above and not an
So my question is basicly, how do I retrieve an attribute such as the phone
number, or the email address of a user etc?
Below is a snippet of the script that I use with the above
Const strDomain = "Waikato"
Const strLdapOU = "OU=InnovatorsOnlineNetwork, OU=wms-users, OU=wms,
DC=waikato, DC=ac, DC=nz"
Const gSubscribers = "ION-Subscribers"
Const gAuthors = "ION-Authors"
Const gEditors = "ION-Editors"
Const gModeratros = "ION-Moderators"
Dim objUserWinNT, objUserLdap, objGroup, strUser
Set objLdapGroup = GetObject( "LDAP://" & strLdapOU )
Function MakeUserObject( strUsername )
Dim GroupObj, UsrObj
Set objUserWinNT = GetObject("WinNT://" & strDomain & "/" & strUsername &
Set GroupObj = GetObject( "LDAP://" & strLdapOU )
For each UserObj in GroupObj
If UserObj.Class = "user" Then
If UserObj.sAMAccountName = strUsername Then
Set objUserLdap = UserObj
MakeUserObject( "aaronc" )
Username: <%= objUserWinNT.Name %>
FullName: <%= objUserWinNT.FullName %>
Description: <%= objUserWinNT.Description %>
Password Never Expires: <%= ( ( objUserWinNT.get( "UserFlags" ) And
&H10000 ) = 1 ) %>
Account Disabled: <%= objUserWinNT.AccountDisabled %>
User is in <%= gSubscribers %>: <%= DispUserInGroup( gSubscribers ) %>