#135835 - 2005-03-16 10:32 PM
In Container
|
Wayne Miller
Fresh Scripter
Registered: 2002-05-14
Posts: 30
Loc: Dallas, TX
|
I am trying to determine what OU a computer is in.
using the UDF
Call "Incontainer.udf"
Code:
$rc = InContainer("OU=ComputerName,OU=Site,OU=BU,DC=us,DC=guess,DC=com", "Computer") ? $rc
I am getting the error code
Script error : expected expression ! $Name2 = TranslateName (3, "", 3, $Name1, 1)
Any Idea? I have both the InContainer.udf and TranslateName.udf functions in the directory as the script.
|
Top
|
|
|
|
#135837 - 2005-03-16 10:51 PM
Re: In Container
|
Wayne Miller
Fresh Scripter
Registered: 2002-05-14
Posts: 30
Loc: Dallas, TX
|
I still got the same error. It seems to be coming from the translate code. If you want I can upload it but I took it directly off the udf library.
|
Top
|
|
|
|
#135839 - 2005-03-16 11:25 PM
Re: In Container
|
Wayne Miller
Fresh Scripter
Registered: 2002-05-14
Posts: 30
Loc: Dallas, TX
|
Thanks. I assumed that the incontainer was calling translatename.
However I am now getting object is Not a member of this container or a chile of this container. However I know it is.
Is it possible I am missing something in the syntax.
Code:
;$rc = InContainer("OU=ComputerName,OU=Site,OU=BU,DC=us,DC=guess,DC=com", "Computer")
|
Top
|
|
|
|
#135842 - 2005-03-17 10:27 PM
Re: In Container
|
Wayne Miller
Fresh Scripter
Registered: 2002-05-14
Posts: 30
Loc: Dallas, TX
|
When exectued the following appears object is NOT a member of this container or a child of this container
However I have verified that computer lta0210896a exist in an ou within the NTX ou
Am I listing the computer name correctly? Code:
Call "translatename.udf" Call "Incontainer.udf" $rc= InContainer("OU=@WKSTA,OU=NTX,DC=us,DC=dseg,DC=com","Computer")
Select Case $rc[0]=1 ? "object is a member of the specified container." Case $rc[0]=2 ? "object is a member of a child container lower in the hierarchy." Case $rc[0]=0 ? "object is NOT a member of this container or a child of this container." Case $rc[0]=-1 ? "InContainer() Error - Invalid input for $NameType " Case $rc[0]=-2 ? "TranslateName() Error" Case 1 ? "Unknown return code" EndSelect
|
Top
|
|
|
|
#135844 - 2005-03-17 10:40 PM
Re: In Container
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
If you post your code that is failing, I would be happy to review it. Be sure to use the Instant UBB code (Code) to properly format the posted code.
|
Top
|
|
|
|
#135846 - 2005-03-18 12:15 AM
Re: In Container
|
Wayne Miller
Fresh Scripter
Registered: 2002-05-14
Posts: 30
Loc: Dallas, TX
|
Thanks Les. Thats It I didn't read the udf paramaters properly.
|
Top
|
|
|
|
#135847 - 2005-04-04 12:30 PM
Re: In Container
|
Jaap_Lelie
Fresh Scripter
Registered: 2005-04-04
Posts: 10
Loc: NL
|
Dazzling...
Simple question, I hope. I've browsed the board and all examples I see start from the principle that I ask "Is this user in OU xxx?" and I get a Yes or a No.
Is there a way to just get a string returned that represents the OU the user is in? like a sort of GetOU("%USERNAME%") so to speak?
My thanks, Jaap.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 466 anonymous users online.
|
|
|