Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


[adsi] empty group, Object not a collection

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> [adsi] empty group, Object not a collection
  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 >>
 [adsi] empty group, Object not a collection - 6/13/2008 4:21:56 AM   
  SirBlade

 

Posts: 28
Score: 0
Joined: 1/11/2006
Status: offline
I made a script to take all groups in a specific OU, and print the name of the group and the names of the group-members to screen. When this script get to a script with 1 or 0 users I get a VBScript runtime error: Object not a collection.

I can understand why it crashes with an empty group, but why does it fail when there's 1 user. I made a workaround by adding a few dummy account to the offending groups, but how can I avoid a probleem like this?


      
 
 
Post #: 1
 
 RE: [adsi] empty group, Object not a collection - 6/16/2008 12:00:15 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
I'm pretty sure that we have dealt with this before. Try searching. Basically, you would use localized On Error Resume Next and VarType to determine what is being returned by the query and handle it appropraitely.

_____________________________

"... 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 SirBlade)
 
 
Post #: 2
 
 RE: [adsi] empty group, Object not a collection - 6/17/2008 12:27:34 AM   
  SirBlade

 

Posts: 28
Score: 0
Joined: 1/11/2006
Status: offline
Thx, that was just the hint I needed.


      

(in reply to ebgreen)
 
 
Post #: 3
 
 
 
  

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 >> [adsi] empty group, Object not a collection 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