Page 1 of 1 1
Topic Options
#157145 - 2006-02-13 04:42 PM LDAP, find computer in diffrent OU's
cellnet Offline
Starting to like KiXtart

Registered: 2002-02-26
Posts: 115
Loc: Sweden
Hi

Dont know if this has been asked before, had som problems with the search phrases.

The problem:
Would like to check if a computer account is located under the default "computers" ou.

Is this possible ?

Br
erik

Top
#157146 - 2006-02-13 05:15 PM Re: LDAP, find computer in diffrent OU's
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
see translatename() UDF to get the computers ldap name
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#157147 - 2006-02-13 05:33 PM Re: LDAP, find computer in diffrent OU's
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
If you want to check the computer that the script is running on then something simple like this will do:
Code:
$=SetOption("WrapAtEOL","ON")

$oADInfo = CreateObject("ADSystemInfo")
$sDefaultContainer="OU=Computers,DC=ACME,DC=com"

"Computer Container: "+$oADInfo.ComputerName+@CRLF

If InStr($oADInfo.ComputerName,$sDefaultContainer)
"Yes, I'm in the Default Computer Container"+@CRLF
Else
"No, I'm not in the Default Computer Container"+@CRLF
EndIf



I'm not sure what the path for the default computer container is - you just need to change the variable to match.

Top
#157148 - 2006-02-14 09:17 AM Re: LDAP, find computer in diffrent OU's
cellnet Offline
Starting to like KiXtart

Registered: 2002-02-26
Posts: 115
Loc: Sweden
Thanks Richard

Works perfect.

Had to change:
$sDefaultContainer="OU=Computers,DC=ACME,DC=com"

to
$sDefaultContainer="CN=Computers,DC=ACME,DC=com"


Thanks
erik

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 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

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

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