Options

batch file to create printer ports

azjagazjag Member Posts: 579 ■■■■■■■□□□
Here is the scenario, The software we use to charge for print jobs requires the printer to be installed locally. That way it can pause the printer while the accounting software works it's magic. The problem with this is we have 700 pc's across 16 locations with 1-6 public printers at each location. I found a way to install the printers via batch file. However I am having issues creating the tcp/ip port without rebooting. When you use the add printer wizard you can create a port and install a printer without rebooting. I've tried .reg files, prnport.vbs and other ways to script it with no luck. Normally we would image a pc, install and configure the printers for that location then sysprep it and create another image. We would then push the image to all the pc's for that branch. That didn't happen this time.

Does anybody have any suggestions on how to script this so that it can create the ports and install the printers without a reboot in between? Is there a service I need to stop/restart after creating the ports to make them work?

It is an xp 2003/2008 environment and due to the software we can't run a print server.

Thanks,
Currently Studying:
VMware Certified Advanced Professional 5 – Data Center Administration (VCAP5-DCA) (Passed)
VMware Certified Advanced Professional 5 – Data Center Design (VCAP5-DCD)

Comments

  • Options
    sambuca69sambuca69 Member Posts: 262
    Have you looked at prnport? Microsoft Corporation It creates TCP/IP printer ports

    Not sure, maybe you have and this is part of your batch script.
  • Options
    ClaymooreClaymoore Member Posts: 1,637
    Since you have 2008, you can use Group Policy Preferences to deploy the printers. Seriously, a different image for each of your 16 locations?

    Deploying TCP/IP Printers with Group Policy Preferences Clay Moore’s Blog
  • Options
    azjagazjag Member Posts: 579 ■■■■■■■□□□
    sambuca69 wrote: »
    Have you looked at prnport? Microsoft Corporation It creates TCP/IP printer ports

    Not sure, maybe you have and this is part of your batch script.

    We tried prnport.vbs but it required a reboot before we could install the printer. Trying to set it up so that it can create the port and install the driver without a reboot. I may be doing it wrong so I will post the exact contents of the script.
    Currently Studying:
    VMware Certified Advanced Professional 5 – Data Center Administration (VCAP5-DCA) (Passed)
    VMware Certified Advanced Professional 5 – Data Center Design (VCAP5-DCD)
  • Options
    azjagazjag Member Posts: 579 ■■■■■■■□□□
    Claymoore wrote: »
    Since you have 2008, you can use Group Policy Preferences to deploy the printers. Seriously, a different image for each of your 16 locations?

    Deploying TCP/IP Printers with Group Policy Preferences Clay Moore’s Blog

    I spoke in error on my original post. We have 2 separate domains, one is a mix of 2k3 and 2k8 and that is the domain that staff works from. Also where the majority of the work is done. The second domain is 2k3 only and it where the public PC's work from. There is a one way trust setup so staff can see public.

    We have one image for all public machines. When we have a major deployment we image a pc at the site then customize the pc for the site then create a master for that site. Printers, desktop management software (deep freeze) and pc usage system for Patrons. Saves us hours when it comes to 50 or so pc's. We then deploy that image to all the pc's at that site then do the final configurations. However the site master image didn't get done this time. So we have to touch all the pc's for these configurations. Also site masters are usually deleted after the process so we don't have to maintain 16 different images.

    I have a script that will work, but it requires a reboot for some reason. This is the script I created.

    Cscript C:\windows\system32\Prnport.vbs -a -r IP_172.20.12.210 -h 172.20.12.210 -o raw -n 9100

    shutdown -r

    rundll32.exe printui.dll,PrintUIEntry /if /b "WT_BW_A" /f \\wt_signup.public.local\lj4015\some.inf /r "IP_172.20.12.210" /m "HP LaserJet 4015"

    And it works as long as there is a reboot between adding the port and installing the printer. If you don't reboot you get an "invalid argument" error. Anybody have any ideas on how to do this without the reboot?
    Currently Studying:
    VMware Certified Advanced Professional 5 – Data Center Administration (VCAP5-DCA) (Passed)
    VMware Certified Advanced Professional 5 – Data Center Design (VCAP5-DCD)
Sign In or Register to comment.