Link to home
Start Free TrialLog in
Avatar of fireguy1125
fireguy1125

asked on

Printer Install Windows 7 using VBS Script

I have been using the following script to add shared network printers for users. This does not work on Windows 7 computers, it just hangs for several minutes after the user logs on, before the profile is loaded, and then, the printers dont end up being installed.

HOWEVER, I found that when I logged on as an administrator, and added the printer manually, then when I logged on as the user, it went through.  I also saw that as an Administrator, I received a prompt asking:

Do you trust the printer? and that Windows needs to download and install a software driver for the \\FNPSERVER computer to print to the printer. Proceed only if you trust the \\FNPSERVER comptuer and the network.

The server and network are the same for all devices, printers, and workstations.  It seems as the user does not have rights to automatically download and install the printer driver, like I have the option as Administrator.  How can I fix this?

The script I use is:

Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection “\\FNPSERVER\SHARP MX-B402-MAIN”
objNetwork.AddWindowsPrinterConnection “\\FNPSERVER\SHARP MX-B402-BACKUP”

It works fine for XP clients, and fine once I select to Install the Driver as an Administrator, then the script runs under the user. It appears to copy files to C:\Users\...{XXXXXXX....} location.  All the Windows 7 computers have UAC turned off.

Thank you.
Avatar of fireguy1125
fireguy1125

ASKER

Also, the script is located in:

Group Policy
User Configuration
Policies
Windows Settings
Scripts (Logon/Logoff)
Logon

However, I see there is another way to do this, that I haven't tried yet, but am reluctant to do so, since I don't know what effect this will have on all the Windows XP computers that already are setup:

Group Policy
UserConfiguration
Preferences
Control Panel Settings
Printers

Also since I am in a mixed 2003 and 2008 domain controller environment, will the above work if the user authenticates to a 2003 domain controller.

I'm hoping there is a settings somewhere in group policy that lets me trust the server that has the driver and installs it without admin credentials.
Avatar of Tony Massa
To use Group Policy Preferences, you need to make sure that you have the GPP client side extensions.  A script should work.  I helped a business partner migrate printers for WinXP and Win7 users, and we didn't have any issues except that he was calling the printer migration script from another script, and his problem was that he called the script from an untrusted location and the Win7 clients wouldn't run it.

Can you copy the file to the NETLOGON directory and test running the script as a "normal" user from the NETLOGON location?  \\domain.local\NETLOGON\TestPrinterScript.vbs.  Manually running is the same as a user logon script.

Make sure that you don't have "On Error Resume Next" enabled for your script.
I think that you must allow on Win7 machines non-administrators that they can install drivers.
Try to enable this in your GPO "Computer Configuration\Administrative Template\System\Driver Installation\Allow non-administrator to install drivers for these device setup classes".
I dont know the setup class for the driver, and the driver is not a signed driver.
ASKER CERTIFIED SOLUTION
Avatar of fireguy1125
fireguy1125

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Found my own resolution.