I seem to have a problem mapping a drive based on AD Group Membership. I want the script to map a drive if you are a member of a certain AD Group. If you are not a memeber I want it to display a message saying you are not a member of a that group. However I am a member of the group specified in my script but it returns an error saying not a member of the group. What have I done wrong?
'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 3.1
'
' NAME: Kirk Marty
'
' AUTHOR: martyk , GTS
' DATE : 5/17/2005
'
' COMMENT:
'
'==========================================================================
'Mapping Network Drives According to User Domain
Set objNetwork = WScript.CreateObject("WScript.Network")
strUserDomain = objNetwork.UserDomain
If strUserDomain = "Domain Admins" Then
objNetwork.MapNetworkDrive "R:", "\\SPNAS1\Install", True
Else
WScript.Echo "User " & objNetwork.UserName & _
"not in Domain Admins R: will not be mapped."
End If