Solved

VBS logon script mapped drives error

Posted on 2007-03-26
4
2,384 Views
Last Modified: 2012-06-27
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.

0
Comment
Question by:sjwall
  • 2
4 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18792827
Line 26 appears to be
objNetwork.MapNetworkDrive "q:", "\\shtc.ad\shtc\data\accounting"

Do the non-admins have right to that share?
0
 
LVL 8

Expert Comment

by:jsvor
ID: 18792829
Are non admins able to access \\shtc.ad\shtc\data\accounting?
0
 

Author Comment

by:sjwall
ID: 18793088
Thanks for the pointer....forgot to check the basics!
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18793092
Happy to help - thanx for the grade! :^)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The use of stolen credentials is a hot commodity this year allowing threat actors to move laterally within the network in order to avoid breach detection.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now