Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VB Help : Count disabled users from AD

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,61802
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VB Help : Count disabled users from AD
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VB Help : Count disabled users from AD - 6/24/2008 5:58:06 AM   
  xiaobao68

 

Posts: 1
Score: 0
Joined: 6/24/2008
Status: offline
Hi,

I have a script here that count the total users from each of the 3 groups in AD. How do I count the account 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
 
 
Post #: 1
 
 RE: VB Help : Count disabled users from AD - 6/24/2008 6:02:56 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
How would you currently identify that an account is disabled?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to xiaobao68)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VB Help : Count disabled users from AD Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts