Hi all-
I am new to vbscripting and I'm trying to determine the best way to accomplish a task.
I'm writing a script that is run when a user logs on to our domain. If the user is a member of the Executives group, I need the script to terminate. Here is what I have so far:
set objNet = CreateObject("Wscript.NetWork")
dim username
dim domainname
username = objNet.UserName
domainname = objNet.UserDomain
Set User = GetObject("WinNT://" & domainname & "/" & username & ",user")
For Each Group in User.Groups
This is where I'm stuck. What I want to do is loop through all the groups the user is a member of. When we are done processing, if the user belongs to the group, exit the script immediately. If the user does not belong to that group, then continue processing. Any one got suggestions?
I am new to vbscripting and I'm trying to determine the best way to accomplish a task.
I'm writing a script that is run when a user logs on to our domain. If the user is a member of the Executives group, I need the script to terminate. Here is what I have so far:
set objNet = CreateObject("Wscript.NetWork")
dim username
dim domainname
username = objNet.UserName
domainname = objNet.UserDomain
Set User = GetObject("WinNT://" & domainname & "/" & username & ",user")
For Each Group in User.Groups
This is where I'm stuck. What I want to do is loop through all the groups the user is a member of. When we are done processing, if the user belongs to the group, exit the script immediately. If the user does not belong to that group, then continue processing. Any one got suggestions?