Add Printer Startup Script

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Hi,

I'm using the following script to add a printer when a computer starts up.
As I want the printer assigned to the computer not the users I've added this
to the the computer configuration section of the GP, (under "Windows
Settings>Startup/Shutdown"), rather than the user configuration section.
However when you reboot the machine you get an error on start up saying
Error at line 4, char 1, error can not find file specified.
But if you login and run the script manually it works fine. How do I get the
script working correctly?
Cheers

Ben

-=Script=-
Option Explicit
Dim oNetwork
Set oNetwork = CreateObject("WScript.Network")
oNetwork.AddWindowsPrinterConnection "\\PRINTSERVER-2K\CUST-ACCOUNTS"
oNetwork.AddWindowsPrinterConnection "\\PRINTSERVER-2K\CUST-SERVICES"
oNetwork.SetDefaultPrinter "\\PRINTSERVER-2K\CUST-ACCOUNTS"
Set oNetwork = Nothing
 
I think the problem you're running into is that a printer is really
connected with the user, not the computer. What you would probably want to
do is set up the default profile on the computer to have the printers and
set your default. Either that, or just apply the script to the users, as
the computer doesn't have a current profile to map a printer to if nobody is
logged on.

Good luck,

Ken
 
Ken B2 said:
I think the problem you're running into is that a printer is
really
connected with the user, not the computer. What you would
probably want to
do is set up the default profile on the computer to have the
printers and
set your default. Either that, or just apply the script to
the users, as
the computer doesn't have a current profile to map a printer
to if nobody is
logged on.

Good luck,

Ken

Hi,

VB Printer Scripts don’t run on startup unfortunately. It has
something to do with the fact that the service for them isn’t started
yet or something to that effect. I use a batch file instead. I have
200 printers and ALL are assigned to machines and not to users. I use
the following in a startup script and it works great.

rundll32 printui.dll,PrintUIEntry /in /q /n "\\server\Printer"

The only issue I have had is that they do tatoo themselves to the
machine so IF you plan to move the machine to another room or another
printer you need to delete the printer either manually or using
another switch. The rundll32 printui.dll,PrintUIEntry is actually
quite powerful. Type it in at the command line with the /? and you
will get a list of the options.

Also, XP machines for some reason won’t show the printer for the user
even though it is there in the startup script. I have had to enable
Group Policy Loopback processing as well and then add the same BAT
file to the User Configuration on the Computer OU. Write again if this
is confusing.

Cheers,
Lara
 
Back
Top