Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need the function map used based dual group membership

Status
Not open for further replies.

Councilk

MIS
May 14, 2003
72
US
Hello All scripting pros out there.. I'm working on a logon script I converted from DOS and I ran into a problem with a function Im using to map a user to a drive.

I keep getting a syntax and compilation error with the code below

[*************************** Function to check dual memebership ********************************************
If InGroup("LANDESKGROUP") Then
bjNetwork.MapNetworkDrive "Q:", "\\aclfs.site.acllab.net\IS"
Else
MsgBox("Call Login script1")
End If

If InGroup("Domain Users") Then
objNetwork.MapNetworkDrive "N:", "\\ACLHEATDB001\Heat Attachments"
Else
MsgBox("Call login script2")


Function InGroup(strGroupName)
Set objNetwork = CreateObject("WScript.Network")
strDomain = objNetwork.UserDomain
strUser = objNetwork.UserName
bIsMember = False
Set objUser = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")
For Each objGroup In objUser.Groups
If objGroup.Name = strGroupName Then
bIsMember = True
Exit For
End If
Next
InGroup = bIsMember
End Function]

Any assistance is greatly appreciated

 
Well for one thing, this If block:

If InGroup("Domain Users") Then
objNetwork.MapNetworkDrive "N:", "\\ACLHEATDB001\Heat Attachments"
Else
MsgBox("Call login script2")

Is never closed with an End If.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Hi EBGreen, sorry for the mixup, you can disregard the conditional statements.

My problem is running this function where I keep receiving the compiler and syntax error

Do you see anything wrong with the syntax in this function

Thx :)
 
Replace this:
End Function]
with this:
End Function

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top