Link to home
Start Free TrialLog in
Avatar of sjwall
sjwall

asked on

VBS logon script mapped drives error

Windows 2003 Server SP1
Windows XP Pro SP 2
WSH 5.6

I'm having a problem getting logon scripts to run for non-admins. If I logon to the machine as an admin, scripts works fine. I get the following error as non-admin:

Windows Script Host
Script \\shdc02\netlogon\shtclogon.vbs
Line 26
Char 1
Error: Access is denied
Code 80070005
Source WSHNetwork.MapNetworkDrive

Logon Script:

Dim objGroupList, objNetwork, objSysInfo, strUserDN, objUser

Set objNetwork = CreateObject("Wscript.Network")
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.userName
Set objUser = GetObject("LDAP://" & strUserDN)

Function IsMember(strGroup)
  Dim objGroup
  If IsEmpty(objGroupList) Then
    Set objGroupList = CreateObject("Scripting.Dictionary")
    objGroupList.CompareMode = vbTextCompare
    For Each objGroup In objUser.Groups
      objGroupList(objGroup.sAMAccountName) = True
    Next
  End If
  IsMember = objGroupList.Exists(strGroup)
End Function

If IsMember("testgroup") Then
objNetwork.MapNetworkDrive "t:", "\\shtc.ad\shtc\data"
objNetwork.AddWindowsPrinterConnection "\\swanprint\Adm$Color"
End If

If IsMember("testgroup2") Then
objNetwork.MapNetworkDrive "q:", "\\shtc.ad\shtc\data\accounting"
End If

How can I get this to work? Thanks.

ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jsvor
jsvor

Are non admins able to access \\shtc.ad\shtc\data\accounting?
Avatar of sjwall

ASKER

Thanks for the pointer....forgot to check the basics!
Happy to help - thanx for the grade! :^)