#86017 - 2002-06-13 04:19 PM
$object.Filter Issue
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Ok Shawn, I need some help. Since you didn't like the Perl version, I translated it into something you can read, but the program dies when the a filter is applied. What maistake did I make.
code:
break on
EnumOUsForComputers("LDAP://us-tyco-e/OU=NCS, OU=Machines, DC=us,DC=tycoelectronics, DC=com", "computer");
Function EnumOUsForComputers($LDAP, $Filter) ;$Filter = 'computer' | 'user' dim $pos $objOU = GetObject($LDAP); "LDAP string='$LDAP'" ? ? if VarTypeName($objOU)='Object' $objOU.Filter = $Filter,"" for each $item in $objOU $Name = $item.get("Name") "@error @Serror $Name" substr($Name,4,instr($Name,"/")-1) ? next $objOU.Filter = "organizationalUnit","" "@error @serror" for each $item in $objOU ? "In OU loop" $pos = instr($LDAP,OU=) $DN = Left($LDAP,$pos-1) + $Name + ", " + substr($LDAP, $pos) ? $DN EnumOUsForComputers($DN); next else "GetObject COM error: " + @error + " " + @serror endif Endfunction
[ 13 June 2002, 16:20: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#86019 - 2002-06-13 04:30 PM
Re: $object.Filter Issue
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Look closer. It is an array; isn't it?
|
Top
|
|
|
|
#86021 - 2002-06-13 04:33 PM
Re: $object.Filter Issue
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
It's a comment describing the valid values.
|
Top
|
|
|
|
#86025 - 2002-06-13 04:48 PM
Re: $object.Filter Issue
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
After using getObject on $LDAP, I:
$objOU.Filter = $Filter,"" using the text in $Filter.
|
Top
|
|
|
|
#86028 - 2002-06-13 05:27 PM
Re: $object.Filter Issue
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I am performing a GetObject on a known OU in AD and do not ever get from a "computer".
Let's just work with the OU loop.
If I comment out the filter I get output. When I use the Filter the script dies. I should be able to enumerate the OU hierarchy with this code.
code:
break on
EnumOUsForComputers("LDAP://us-tyco-e/OU=NCS, OU=Machines, DC=us, DC=tycoelectronics, DC=com", "computer");
Function EnumOUsForComputers($LDAP, $Filter) ;$Filter = 'computer' | 'user' dim $pos $objOU = GetObject($LDAP); "LDAP string='$LDAP'" ? ? if VarTypeName($objOU)='Object' ; $objOU.Filter = $Filter,"" ; for each $item in $objOU ; $Name = $item.Name ; "@error $Name " + $objOU.class ? ; substr($Name,4,instr($Name,"/")-1) ? ; next ;$objOU.Filter = "organizationalUnit","" for each $item in $objOU $Name = $item.Name $pos = instr($LDAP,"OU=") $DN = Left($LDAP,$pos-1) + $Name + ", " + substr($LDAP, $pos) EnumOUsForComputers($DN, $Filter); next else "GetObject COM error: " + @error + " " + @serror endif Endfunction
[ 13 June 2002, 17:55: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#86030 - 2002-06-13 06:03 PM
Re: $object.Filter Issue
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Yes you are right - I should be -> and now I am and still no joy. Same old crap.
I known I have a valid object to start with:
quote: c:\data\scripts>C:\Data\Kix2001\KiX2001.410rc2\kix32 enumOus.kix LDAP string='LDAP://us-tyco-e/OU=NCS, OU=Machines, DC=us, DC=tycoelectronics, DC=com'
Class: organizationalUnit GUID: {228D9A87-C302-11CF-9AA4-00AA004A5691} Implemented by: {228D9A8C-C302-11CF-9AA4-00AA004A5691}
Container Object Class Contains: remoteMailRecipient msExchConfigurationContainer container intellimirrorGroup organizationalUnit indexServerCatalog computer locality ipsecNFA applicationEntity ipsecISAKMPPolicy serviceAdministrationPoint contact intellimirrorSCP mS-SQL-OLAPServer mSMQMigratedUser physicalLocation remoteStorageServicePoint volume mS-SQL-SQLServer group rRASAdministrationConnectionPoint user nTFRSSettings serviceConnectionPoint ipsecNegotiationPolicy dSA dMD rpcContainer domainPolicy ipsecPolicy ipsecFilter groupPolicyContainer printQueue classStore Mandatory Properties in this Class: instanceType nTSecurityDescriptor objectCategory objectClass ou
Optional Properties in this Class: adminDescription adminDisplayName allowedAttributes allowedAttributesEffective allowedChildClasses allowedChildClassesEffective bridgeheadServerListBL businessCategory c canonicalName cn co countryCode createTimeStamp defaultGroup description desktopProfile destinationIndicator directReports displayName displayNamePrintable distinguishedName dSASignature dSCorePropagationData extensionName facsimileTelephoneNumber flags fromEntry frsComputerReferenceBL fRSMemberReferenceBL fSMORoleOwner gPLink gPOptions internationalISDNNumber isCriticalSystemObject isDeleted isPrivilegeHolder l lastKnownParent managedBy managedObjects masteredBy memberOf modifyTimeStamp mS-DS-ConsistencyChildCount mS-DS-ConsistencyGuid name netbootSCPBL nonSecurityMemberBL objectGUID objectVersion otherWellKnownObjects partialAttributeDeletionList partialAttributeSet physicalDeliveryOfficeName possibleInferiors postalAddress postalCode postOfficeBox preferredDeliveryMethod proxiedObjectName proxyAddresses queryPolicyBL registeredAddress replPropertyMetaData replUpToDateVector repsFrom repsTo revision sDRightsEffective searchGuide seeAlso serverReferenceBL showInAdvancedViewOnly siteObjectBL st street subRefs subSchemaSubEntry systemFlags telephoneNumber teletexTerminalIdentifier telexNumber thumbnailLogo uPNSuffixes url userPassword uSNChanged uSNCreated uSNDSALastObjRemoved USNIntersite uSNLastObjRem uSNSource wbemPath wellKnownObjects whenChanged whenCreated wWWHomePage x121Address
c:\data\scripts>
I know that with the filter commented out that the script does properly enumerate the objects in the container. It enumerates bother computers and other OUs.
But when the Filter is applied the script dies.
Shawn when are you going to setup an AD domain? We need to deligate our troubleshooting expenses to you. ![[Big Grin]](images/icons/grin.gif) [ 13 June 2002, 18:12: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#86032 - 2002-06-13 06:12 PM
Re: $object.Filter Issue
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I think that the filter is broken when applied to OU objects (at least) since it seems to work other places.
I get tons of output - thousands on objects without the filter.
If I manually filter: code:
$objOU = GetObject($LDAP); if $objou.class <> "organizationalunit" exit 0 endif
I only get OU's and no computers. Can someone with AD please try to verify this issue? [ 13 June 2002, 18:13: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#86036 - 2002-06-13 07:20 PM
Re: $object.Filter Issue
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
naa... probably playing with RC cars in the parking lot
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 1574 anonymous users online.
|
|
|