Sign in to follow this  
Followers 0
lavascript

Help troubleshooting printer management

4 posts in this topic

Ok, I'm hoping someone here can spot a problem that I'm missing.

I'm in the process of converting all my workstations from printing through a print server to using TCP/IP ports. To make things easier, I'm scripting what I can.

The script below is an example of what I'm doing, for an HP LaserJet P3005 and a Color LaserJet 3600.

It works beautifully for both on x64, and for the color on x86, but with the p3005 on x86, I get an "Operation could not be completed" error. Since the only differences between the commands seem to be the driver, it would be the likely culprit. But on the same x86 XP box that throws the error, I can manually install that same driver with no problem. I'm attaching the .inf file in case it helps.

Also, that box already had a P3005 PCL6 driver, so the /u switch on PrintUIEntry should have ignored the driver path, right?

Anybody see something I'm missing?

Thanks.

InstallPrinter("HS Lobby 1","10.38.124.145","p3005")
InstallPrinter("HS Lab Color","10.38.124.181","clj3600")

Func InstallPrinter($PrName,$Address,$Driver,$Prompt=0)

Local $msg
If $Prompt = 1 Then $msg = MsgBox(35,"Question","Install "&$PrName&"?")
Sleep(100)
If $msg = 2 Then Exit
If $msg = 7 Then Return

$objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$objNewPort = $objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_

$objNewPort.Name = "IP_"&$Address
$objNewPort.Protocol = 1
$objNewPort.HostAddress = $Address
$objNewPort.PortNumber = "9100"
$objNewPort.SNMPEnabled = False
$objNewPort.Put_

$DriverPath = "\\server\util\drivers\"&@OSArch&"\printers"

;I've removed several of the Cases here for brevity.

Select
Case @OSArch="x86" AND $Driver="p3005"
$LocalPath = $DriverPath & "\ljp3005.pcl6\hpc300xc.inf"
$Model = "HP LaserJet P3005 PCL 6"
Case @OSArch="x64" AND $Driver="p3005"
$LocalPath = $DriverPath & "\ljp3005.pcl6\hpc300xu.inf"
$Model = "HP LaserJet P3005 PCL 6"
Case @OSArch="x86" AND $Driver="clj3600"
$LocalPath = $DriverPath & "\clj3600\hpc3600e.inf"
$Model = "HP Color LaserJet 3600"
Case @OSArch="x64" AND $Driver="clj3600"
$LocalPath = $DriverPath & "\clj3600\hpc3600w.inf"
$Model = "HP Color LaserJet 3600"
Case $Driver="wc5135"
$LocalPath = $DriverPath & "\wc5135.ps\x2WPENP.inf"
$Model = "Xerox WorkCentre 5135 PS"
Case $Driver="d2150"
$LocalPath = $DriverPath & "\d2150.pcl6\dlxrozi.inf"
$Model = "Dell 2150cdn Color Printer PCL6"
EndSelect

RunWait('rundll32 printui.dll,PrintUIEntry /if /b "'&$PrName&'" /f "'&$LocalPath&'" /r "IP_'&$Address&'" /m "'&$Model&'" /u')

EndFunc

hpc300xc.inf.txt

Share this post


Link to post
Share on other sites



Have you looked at WebJetAdmin?

No, but we're not an hp-only shop. We've also got to manage Xerox machines, Dell printers, and even a few Brothers.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • jguinch
      By jguinch
      Here is an UDF for managing printers.
      Features are :
       - add, remove or rename a printer
       - add or remove a driver
       - add or remove a TCP/IP printer port
       - add or remove a LPR printer port
       - connect to a remote printer
       - enum printers and there configuration and properties
       - pause resume or cancel all jobs of a printer
       - checks if a printer exists
       - print a test page
       - set the default printer
    • faldo
      By faldo
      "The why"
      I've been working over 15 years in the IT industry and have realised that the best way of streamlining operations and support is by combining the concept of selling services (instead of hours) along with a tool built for managing those services.
      For the past 10 years i've been working with some of the leading providers of MSP-tools. The prize set on these comercial tools is quite high and there are usually few licence models to choose from. A smaller it-company will find the cost hard to motivate and in turn have dificulties converting its busines model in order to make more money, classic catch 22
      "The how"
      During the years, i've gathered the pros and cons of these tools, dissected their core and realised there is no magic or rocket science going on. There is however a whole lot of scripting used and that's why i feel AutoIT would be a great foundation for a new project.
      So, i've decided to compile my years of experiance and create a tool for remote management and monitoring of machines over WAN. Instead of monetizing it and try to compete with the big companies i felt it more efficiant to make it open source and hope for community interest and development.
      "The what"
      The following features are under development, some arn't started, some are finished. Check the changelog for more info.
      Base components
      - Agent running as service
      - Central server with MySQL (hub engine)
      - Management client (AutoitGUI/WebGUI)
      Main features
      - Remote execution of shell commands as system or specific user
      - File transfer from/to agent
      - Live monitoring of system resources
      Consequential features (based on main features)
      - Hardware/software inventory
      - Software deployment/updating
      - Patch management
      - Antivirus management
      - OS deployment
      - Disaster recovery
      - Hardware/software/network monitoring
      - Wake on LAN
      - Reporting
      - Remote registry, event viewer, task manager
      - Scripting (obviously)
      Additional features (stand-alone modules)
      - Remote control
      - Servicedesk (based on ITIL)
      - AD-integration
      Security
      - Secure communication with SSL and rotating key for every session.
      - SHA256 encryption.
      Remmanaut network overview

       
       
      My knowledge of AutoIT is average but i'm novice when it comes to programing structure for collaboration, so if you're willing to help me out in making the project easy to share, i'd be very thankfull. Unfortunatly i'm no php-guru so i'll be concentrating on the AutoitGUI until the agent and hub engine reaches an adequate version.

      If you feel that this tool could benefit you in any way or just want to join the project for the fun of development, don't hesitate to post constructive feedback or hit me a PM.
      Code optimisation to do:
       
      Download:
       
       
    • faldo
      By faldo
      Remmanaut, the autoit RMM tool.
    • Milas
      By Milas
      So instead of reinventing the wheel. I was trying to find a way auto launch this window to search for printers on the network. we are moving to a more universal naming convention based on printer location so I wanted to give users the easiest way I know of to find and map to a printer. Is there a way to auto launch this window. is it contained somewhere I can access on the computer?
      thank you for the assistance