Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Logon scripts permission issues on windows 7

Posted on 2010-09-02
7
Medium Priority
?
619 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 57

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 57

Accepted Solution

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

Expert Comment

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Assume you have an outside contractor who comes in seasonally or once a week to do some work in your office, but you only want to give him access to the programs and files he needs and keep all other documents and programs private. Can you do this o…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
Suggested Courses

916 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