Add Printer Startup Script

Archived from groups: microsoft.public.win2000.group_policy (More info?)

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
2 answers Last reply
More about printer startup script
  1. Archived from groups: microsoft.public.win2000.group_policy (More info?)

    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

    "Ben" <bjblackmore@nospam.hotmail.com> wrote in message
    news:ug8W3XZ%23EHA.2076@TK2MSFTNGP15.phx.gbl...
    > 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
    >
    >
  2. Archived from groups: microsoft.public.win2000.group_policy (More info?)

    "Ken B2" wrote:
    > 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
    >
    > "Ben" <bjblackmore@nospam.hotmail.com> wrote in message
    > news:ug8W3XZ%23EHA.2076@TK2MSFTNGP15.phx.gbl...
    > > 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-2KCUST-ACCOUNTS"
    > > oNetwork.AddWindowsPrinterConnection
    > "\PRINTSERVER-2KCUST-SERVICES"
    > > oNetwork.SetDefaultPrinter "\PRINTSERVER-2KCUST-ACCOUNTS"
    > > Set oNetwork = Nothing
    > >
    > >

    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

    --
    Posted using the http://www.WindowsForumz.com/ interface, at author's request
    Articles individually checked for conformance to usenet standards
    Topic URL: http://www.WindowsForumz.com/Group-Policy-Add-Printer-Startup-Script-ftopict250179.html
    Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.WindowsForumz.com/eform.php?p=771480
Ask a new question

Read More

Computers Configuration Printers Windows