Solved

Logon scripts permission issues on windows 7

Posted on 2010-09-02
7
605 Views
Last Modified: 2012-05-10
I have written a logon script to map a printer on my domain. originally we had only XP machines, now we have added 12 windows 7 machines. The script runs fine on the xp, but standard users get access denied errors when they log on to a win7 machine and the script attempts to run. Below is a copy of the code in the script. I want to know if there is way to insert some sort of code that will allow the script to run with the appropriate permissions even if a standard user logs on the a win 7 machine.
****************************************************start code****************************************
'Written by Zay Scott on 1\18\10
'This is a script to map printers
'The script also sets the default printer as well

Option Explicit

Dim objNetwork, strUNCPrinter1, strUNCPrinter2
strUNCPrinter1 = "\\tb-dc01\Savin_C9020"
strUNCPrinter2 = "\\tb-dc01\Savin8025"

Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter1
objNetwork.SetDefaultPrinter strUNCPrinter1
'WScript.Echo "Username: " & WshNetwork.UserName

WScript.Quit
0
Comment
Question by:xzay1967
  • 3
  • 3
7 Comments
 
LVL 65

Expert Comment

by:RobSampson
ID: 33592999
Can you browse manually to the print server, right click the printer, and click Connect?

If you still get access denied errors, then your policy must be disabling the ability for users to install the drivers.

Regards,

Rob.
0
 

Author Comment

by:xzay1967
ID: 33595677
I have not tried that, but the issue is generated when the driver needs to be installed. For the time being, I have logged on as admin, installed the driver. When the standard user logs on, the driver is already installed, and the printer is added. Luckily there are only 12 win7 machines, but  would still like to know how to write the script so that when it runs, it has elevated rights and installs the driver for the standard users.
0
 
LVL 53

Expert Comment

by:McKnife
ID: 33596067
To elevate a logon script, you will need the administrator password somehow coded into it together with some runas tool. You should use GPO printer deployment.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:xzay1967
ID: 33597582
So if I use a GPO instead of a log on script, that would eliminate the permission issue? I honestly think this is a windows  7 specific issue; there is no permission issue when logging to an XP machine. I somewhere that disabling UAC should take care of it. I don't want to do that, that only circumvents the issue not solve it. I do appreciate the input so far.
0
 
LVL 53

Accepted Solution

by:
McKnife earned 500 total points
ID: 33598538
If your xp users are either admins or power users, they can install printers.
On vista/win7, users have to be admins (power users don't exist in vista/win7) AND the actions theydo respectively the scripts they execute have to run elevated - by default they don't - that's UAC.

GPO printer deployment is running elevated by default.
0
 

Author Comment

by:xzay1967
ID: 33598722
I will try the GPO option and see how that works. But does the GPO take of the driver installation issue as well? The scripts fine, it is the driver installation portion that triggers the permission error.
0
 
LVL 53

Expert Comment

by:McKnife
ID: 33598735
Yes, it does.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

708 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

16 Experts available now in Live!

Get 1:1 Help Now