|
I just whipped up this _vbscript_ to get
you started. I don't have time to provide a more detailed breakdown
as that involves a little extra thought, but this should point you in the right
direction...
Save, for example, as c:\count.vbs and
run, from CMD, like so:
cscript c:\count.vbs
> count.xls
Dim oRootDse, oBase
Set oRootDse = GetObject("LDAP://RootDSE")
Set oBase = GetObject("LDAP://" & oRootDse.get("defaultNamingContext")) countObjects oBase.ADsPath, 0 ' ***********************************************
' countObjects(ADsPath, count) ' ' Recursive function to count the number of children ' in a container. ' ' *********************************************** Private Function countObjects(oParent, iCount) Dim oChild, cChildren, aSchema, sSchema Dim i : i = 0 Set cChildren = GetObject(oParent) For Each oChild In cChildren aSchema = Split(oChild.schema,"/") sSchema = aSchema(UBound(aSchema,1)) i = i + 1 c = countObjects(oChild.ADsPath, i) If(Not(sSchema = "inetOrgPerson" Or _ sSchema = "user" Or _ sSchema = "computer" Or _ sSchema = "group"))Then WScript.Echo oChild.get("distinguishedName") & vbTab &c End If Next countObjects=i End Function --Paul
|
- Re: [ActiveDir] machine GP load Paul Williams
- RE: [ActiveDir] machine GP load Ramon Linan
- Re: [ActiveDir] machine GP load Paul Williams
- RE: [ActiveDir] machine GP load Ramon Linan
