Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VBScript to get Active Directory Info

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,64105
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBScript to get Active Directory Info
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VBScript to get Active Directory Info - 9/7/2008 10:56:13 PM   
  stefanDDD

 

Posts: 2
Score: 0
Joined: 9/7/2008
Status: offline
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
 
 
Post #: 1
 
 RE: VBScript to get Active Directory Info - 9/7/2008 11:06:17 PM   
  ginolard


Posts: 1061
Score: 21
Joined: 8/10/2005
Status: offline
Check the "AD Query template" link in my sig

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to stefanDDD)
 
 
Post #: 2
 
 RE: VBScript to get Active Directory Info - 9/8/2008 12:11:58 AM   
  stefanDDD

 

Posts: 2
Score: 0
Joined: 9/7/2008
Status: offline
thanks. Isnt there a shorter way to just get a single attribute from the current user logged in? Basically if joe logs in a small script runs and says "your email is joe@go.com" which it obviously get from the AD user attributes

(in reply to ginolard)
 
 
Post #: 3
 
 RE: VBScript to get Active Directory Info - 9/8/2008 1:13:55 AM   
  dm_4ever


Posts: 2669
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Technically something like this should be enough


      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to stefanDDD)
 
 
Post #: 4
 
 RE: VBScript to get Active Directory Info - 9/8/2008 2:38:07 AM   
  ginolard


Posts: 1061
Score: 21
Joined: 8/10/2005
Status: offline
Ah, you might have mentioned this was for a login script ;)

As mentioned, AdSystemInfo is ideal for this.

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to dm_4ever)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBScript to get Active Directory Info Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts