Page 1 of 1 1
Topic Options
#205551 - 2012-08-17 03:29 PM Unable to query LDAP unless a domain admin
Doofenshmirtz Offline
Just in Town

Registered: 2010-11-05
Posts: 4
Loc: Baltimore, MD
I have a login script I wrote years ago and have used with minor tweaking at two different jobs/domains. Now, at the new job, the following code only works when I use my domain admin credentials:

 Code:
$objSys = CreateObject("ADSystemInfo") 
$objUser = GetObject("LDAP://"+$objSys.UserName)

select
	case @time <= "11:59:59" ? " Good morning, " ($objUser.givenName) + " " + ($objUser.sn)
	case @time >= "12:00:00" and @time <= "16:59:59" ? " Good afternoon, " ($objUser.givenName) + " " + ($objUser.sn)
	case @time >= "17:00:00" ? " Good evening, " ($objUser.givenName) + " " + ($objUser.sn)
endselect


With my regular domain user account, I get an error right after the "Good morning, " (or whatever the time case works out to) greeting. With domain admin, it runs just fine.

What could be causing this to not work for the average user?

Thanks!

Top
#205552 - 2012-08-17 03:43 PM Re: Unable to query LDAP unless a domain admin [Re: Doofenshmirtz]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
permissions.

start from the beginning, add error lines and run:
 Code:
$objSys = CreateObject("ADSystemInfo") 
"objsys: " @error ?
$objUser = GetObject("LDAP://"+$objSys.UserName)
"objuser: " @error ?
get $
_________________________
!

download KiXnet

Top
#205553 - 2012-08-17 03:44 PM Re: Unable to query LDAP unless a domain admin [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
just a silly question... is there a reason why @fullname-macro doesn't work for you?
_________________________
!

download KiXnet

Top
#205554 - 2012-08-17 04:50 PM Re: Unable to query LDAP unless a domain admin [Re: Lonkero]
Doofenshmirtz Offline
Just in Town

Registered: 2010-11-05
Posts: 4
Loc: Baltimore, MD
The results of the error lines as a user:
objsys: 0
objuser: -2147024843

The results of the error lines as a domain admin:
objsys: 0
objuser: 0

@fullname works just fine. The users full names here are lastName, firstName. Saying "Good morning, Doe, John" just looks bad. Concatenating their first name (givenName) and last name (sn) looks better. There are other LDAP attributes I am looking to display, too, at some point.


Edited by Doofenshmirtz (2012-08-17 04:53 PM)

Top
#205555 - 2012-08-17 04:57 PM Re: Unable to query LDAP unless a domain admin [Re: Doofenshmirtz]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Try
 Code:
$Fullname = @FULLNAME
If InStr(@FULLNAME, ',')                   ; if last, first
  $aName=Split(@FULLNAME, ',')             ; split
  $FullName = @Name[1] + ' ' + $Name[0]    ; in reverse order
EndIf
Also, replace @ERROR with @SERROR for human-readable messages.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#205556 - 2012-08-17 05:08 PM Re: Unable to query LDAP unless a domain admin [Re: Glenn Barnas]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
Converting the com error to a standard error...

 Code:
? VAL("&"+Right(DecToHex(-2147024843),4))


...returns 53... "The network path was not found."

Not sure that applies here, but it definitely feels like permissions.

Top
#205557 - 2012-08-17 07:12 PM Re: Unable to query LDAP unless a domain admin [Re: Glenn Barnas]
Doofenshmirtz Offline
Just in Town

Registered: 2010-11-05
Posts: 4
Loc: Baltimore, MD
Wow, never thought of splitting the full name. That will work nicely for now.

Thanks, Glenn!

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 557 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.063 seconds in which 0.029 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org