Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


return LDAP query for logged in user.

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> return LDAP query for logged in user.
  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 >>
 return LDAP query for logged in user. - 7/23/2007 7:06:08 AM   
  xneilpetersonx

 

Posts: 3
Score: 0
Joined: 7/23/2007
Status: offline
I have a script that queries against my AD for all user objects and returns some specified attributes (displayName and extensionAttribute1) for all users. What I want to do now is create a script that when run will go out to AD and return these attributes for just the individual user that has run the script. My assumption is that I need to a piece that will return the LDAP query for the logged in user (or user whom has run the script) and then use this to find the user account attributes; however I cannot figure out how to find the LDAP query for the user. Does anyone have a sample vbscript that shows how to find the LDAP query for a specific user account?
 
Thanks
 
neilp
 
 
Post #: 1
 
 RE: return LDAP query for logged in user. - 7/23/2007 7:08:33 AM   
  dm_4ever


Posts: 2663
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Dim adSysInfo : Set adSysInfo = CreateObject("ADSystemInfo")
Dim objUser : Set objUser = GetObject("LDAP://" & adSysInfo.UserName)
WScript.Echo objUser.displayName

_____________________________

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 xneilpetersonx)
 
 
Post #: 2
 
 RE: return LDAP query for logged in user. - 7/23/2007 7:20:27 AM   
  xneilpetersonx

 

Posts: 3
Score: 0
Joined: 7/23/2007
Status: offline
Sweet - thanks for your help, this will enable me to do exactally what I need.

neilp

(in reply to dm_4ever)
 
 
Post #: 3
 
 RE: return LDAP query for logged in user. - 8/5/2007 2:43:32 AM   
  Spike999

 

Posts: 1
Score: 0
Joined: 8/5/2007
Status: offline
Is there any way you can trick the script into thinking another user is logged on?? I have a script that all our users use to generate an email signature, it retrieves information from AD on the user logged on such as the name, job title, phone number and so on. This is all good and well but most of the directors have PA's and they have permission to send emails on behalf of the director it would be nice to allow them to generate a the script automatically by just picking the directors name from a drop down menu or entering there name in a box.

(in reply to xneilpetersonx)
 
 
Post #: 4
 
 RE: return LDAP query for logged in user. - 8/5/2007 12:50:58 PM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Instead of tricking it into thinking another user is logged on, you might want to get the DN for a user and use that instead of the logged on user.

I use this http://www.visualbasicscript.com/fb.aspx?m=48443 to do my LDAP queries.  I have optimized that code a bit for performance on my own systems, but it is portable enough to use anywhere and work as it is.
It should give you a better idea of how to structure the queries to get what you want.

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to Spike999)
 
 
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 >> return LDAP query for logged in user. 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