IT Management Suite

  • 1.  Network printer installation ran as a job

    Posted May 28, 2008 11:43 AM
    I am having a ton of trouble writing a script to install network printers to all users by dropping a job with this script included. Here is the script im trying to get working. rundll32 printui.dll,PrintUIEntry /ga /q /n\\server\printer :: restart print spooler START /WAIT SC STOP spooler START /WAIT SC START spooler After looking through the switches, im using /ga to add it for all users which is very crucial, /q for not displaying error messages, and /n to to out to the network for the printer. I also added the restart of the print spooler on the bottom. This script sais its completed successfully in the Deployment Console, but no matter who's logged on to the domain, ththis printer doesn't show up. I have tried several other commands such as /in as well as /y and I cannot get it to work. Any suggestions would be greatly appreciated. Thank you, =Brandon


  • 2.  RE: Network printer installation ran as a job

    Posted May 28, 2008 06:46 PM
    You can add a printer with a login script which is the recommended way by Microsoft for a network environment. Do you need a code sample to put into a login visual basic script or does this have to be done via a job?


  • 3.  RE: Network printer installation ran as a job

    Posted May 29, 2008 11:32 AM
    '******************************************************************
    '****                Type the name of the printer	       ****
    '****                   that you would like to 		       ****
    '****                       install below		       ****
    '****		     ex: "\\hs-is\hs.lib.lj5000" 	       ****
    '******************************************************************
    PrinterPath = "\\prap_Lab\DO.038.lj"
    'PrinterPath1 = "\\PRAP_Lab\tech.color"
    'PrinterPath2 = "\\PRAP1\hs.sci.chem"
    'PrinterPath3 = "\\PRAP1\hs.sci.chem"
    
    '*******************************************************************
    '****	Check to see if there are any local printers installed	****
    '*******************************************************************
    On Error Resume Next
    def_printer = ""
    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set colInstalledPrinters = objWMIService.ExecQuery ("Select * from Win32_Printer")
    For Each objPrinter in colInstalledPrinters
       if left(objPrinter.Name,2) <> "\\" then
          Def_printer = objPrinter.Name
       end if	
    Next
    
    '*******************************************************************
    '****			Map the network printers		****
    '*******************************************************************
    Set WshNetwork = CreateObject("WScript.Network")
    WshNetwork.AddWindowsPrinterConnection PrinterPath
    'WshNetwork.AddWindowsPrinterConnection PrinterPath1
    'WshNetwork.AddWindowsPrinterConnection PrinterPath2
    'WshNetwork.AddWindowsPrinterConnection PrinterPath3
    
    '*******************************************************************
    '****			Set the default printer			****
    '*******************************************************************
    if def_printer = "" then
       WshNetwork.SetDefaultPrinter printerpath
    else
       WshNetwork.SetDefaultPrinter def_printer
    end if
    
    '*******************************************************************
    '****				Error Trap			****
    '*******************************************************************
    If Err.Number <> 0 then
          WScript.Echo "Printer Connection Failed! " & err.description 
    End If