csc123ster
IS-IT--Management
Hi,
I have a script here that count the total users from each of the 3 groups in AD. How do I count the total accounts that are disabled from the 3 groups? Thanks for the advice
set objacTypes = createobject("Scripting.Dictionary")
objacTypes.Add 1, "IUsers"
objacTypes.Add 2,"ITrials"
objacTypes.Add 3, "IInternal"
for z =1 to 3
strgroup = "cn=" & objactypes.item(z) & ",ou=TONE,ou=TS,DC=dom,dc=abc,dc=net"
'wscript.echo strgroup
Set objGroup = GetObject("LDAP://" & strgroup )
i = 0
Set objDictionary = CreateObject("Scripting.Dictionary")
For Each strUser in objGroup.Member
Set objMember = GetObject("LDAP://" & strUser)
if not objmember.Accountdisabled then
'wscript.echo struser
i = i + 1
strtype = objMember.Class
If Not objDictionary.Exists(strType) Then
objDictionary.Add strType, "1"
Else
objDictionary.Item(strType) = objDictionary.Item(strType) + 1
End If
end if
Next
if z=3 then i = i +2
Wscript.Echo objactypes.item(z) & ": Total=" & i
totusrs= totusrs+i
Disabled
'For Each objType in objDictionary
' Wscript.Echo objType & ": " & objDictionary.Item(objType)
'Next
next
wscript.echo "Total: " & totusrs
I have a script here that count the total users from each of the 3 groups in AD. How do I count the total accounts that are disabled from the 3 groups? Thanks for the advice
set objacTypes = createobject("Scripting.Dictionary")
objacTypes.Add 1, "IUsers"
objacTypes.Add 2,"ITrials"
objacTypes.Add 3, "IInternal"
for z =1 to 3
strgroup = "cn=" & objactypes.item(z) & ",ou=TONE,ou=TS,DC=dom,dc=abc,dc=net"
'wscript.echo strgroup
Set objGroup = GetObject("LDAP://" & strgroup )
i = 0
Set objDictionary = CreateObject("Scripting.Dictionary")
For Each strUser in objGroup.Member
Set objMember = GetObject("LDAP://" & strUser)
if not objmember.Accountdisabled then
'wscript.echo struser
i = i + 1
strtype = objMember.Class
If Not objDictionary.Exists(strType) Then
objDictionary.Add strType, "1"
Else
objDictionary.Item(strType) = objDictionary.Item(strType) + 1
End If
end if
Next
if z=3 then i = i +2
Wscript.Echo objactypes.item(z) & ": Total=" & i
totusrs= totusrs+i
Disabled
'For Each objType in objDictionary
' Wscript.Echo objType & ": " & objDictionary.Item(objType)
'Next
next
wscript.echo "Total: " & totusrs