# VBScript to get INFO from Active Directory



## stefanDDD

I am trying to get account info from AD using a vb script. This is my VBScript:
"
Set objUser = GetObject _
("LDAP://CN=blue,OU=units,DC=sunap,DC=aknt")
objUser.GetInfo

strProfilePath = objUser.Get("mail")
WScript.echo "Email: " & strProfilePath
"

I get the "directory property cannot be found in the cache" error.

Im running windows 2003 std. I am sure that the users deatails are filled in correctly.

What I basically want to do is run the script when the user logs in and let it display the currents users email address according to the AD attributes


----------



## GraemeI

If you haven't done so you should add the following statement at the start.

On Error Resume Next


If you still have problems why not try this 

On Error Resume Next

Set objUser = GetObject _
("LDAP://CN=blue,OU=units,DC=sunap,DC=aknt")
objUser.GetInfo

strMail = objUser.Get("mail")
WScript.Echo "Email: " & objUser.mail


----------

