Solved

VBS logon script mapped drives error

Posted on 2007-03-26
4
2,459 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 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
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…
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…

724 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