xzay1967
asked on
Logon scripts permission issues on windows 7
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.
************************** ********** ********** ******star t 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.Netw ork")
objNetwork.AddWindowsPrint erConnecti on strUNCPrinter1
objNetwork.SetDefaultPrint er strUNCPrinter1
'WScript.Echo "Username: " & WshNetwork.UserName
WScript.Quit
**************************
'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.Netw
objNetwork.AddWindowsPrint
objNetwork.SetDefaultPrint
'WScript.Echo "Username: " & WshNetwork.UserName
WScript.Quit
ASKER
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.
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.
ASKER
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
Yes, it does.
If you still get access denied errors, then your policy must be disabling the ability for users to install the drivers.
Regards,
Rob.