Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBS logon script mapped drives error

Posted on 2007-03-26
4
Medium Priority
?
2,507 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

636 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