Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Question: Need help with an If statement to determine group membership

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Question: Need help with an If statement to determine group membership
  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 >>
 Question: Need help with an If statement to determine g... - 6/15/2007 7:35:28 AM   
  ehull82

 

Posts: 8
Score: 0
Joined: 6/12/2007
Status: offline
Hey everyone,
Thanks for the help with my last question regarding what certain lines of code did.  My new question is a little more complicated.

I'm writing a logon script that first deletes any existing network drives or printers and then maps drives and printers based on the users groups.

So far I've got it deleting the printer but now I'm trying to write and If Then statement to determine the users group and its causing me problems.

What I would like is to have a script that does something like this:

      

Below is my entire script to this point.  I'm not exactly certain what would be the most efficient way to go about doing this, as there are users who are members of multiple groups that need to be checked for.  Any and all scripting wisdom is welcome as I'd like to make this script as fast and efficient as possible.


      

Eric
 
 
Post #: 1
 
 RE: Question: Need help with an If statement to determi... - 6/15/2007 7:51:18 AM   
  ehvbs

 

Posts: 2223
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi ehull82,

does each user belong to exactly one group?

ehvbs

(in reply to ehull82)
 
 
Post #: 2
 
 RE: Question: Need help with an If statement to determi... - 6/15/2007 7:59:34 AM   
  ehull82

 

Posts: 8
Score: 0
Joined: 6/12/2007
Status: offline
Nope, we seem to be group happy at this company.  So like myself, I am a member of
Support Users
I.T. Staff
All Employees
etc. (a few more redudant ones)

My manager is a member of all those groups as well in addition to an office manager group.

The group structure is pretty convuluted.

(in reply to ehvbs)
 
 
Post #: 3
 
 RE: Question: Need help with an If statement to determi... - 6/15/2007 8:08:13 AM   
  ehvbs

 

Posts: 2223
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Then you have to change your pseudo code to:

For Each Group In TheListOfAllGroupTheUserBelongsTo
   Select Case Group
      Case GroupX
        Map drive T:
        Map drive U:   <-------
        Map drive V:
        Set Printer X as default
     Case GroupY
          Map drive U:   <------
        Map drive V:
         Set Printer Y as default
     Case GroupZ
         etc
     Case Else
        Diagnostics/Error: Group not accounted for
   End Select
Next

(in reply to ehull82)
 
 
Post #: 4
 
 RE: Question: Need help with an If statement to determi... - 6/15/2007 8:28:07 AM   
  ehull82

 

Posts: 8
Score: 0
Joined: 6/12/2007
Status: offline
Awesome, so its kind of like a GoTo statement?  where it only executes the code for the specific case?

Thanks again!

(in reply to ehvbs)
 
 
Post #: 5
 
 
 
  

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 >> Question: Need help with an If statement to determine group membership 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