free log
CRM

Bozteck VNCScan Community

Community makes things happen
Welcome to Bozteck VNCScan Community Sign in | Join | Help
in
Home Forums

Silently add printers to user pcs

Last post 07-26-2007, 11:09 AM by ltorrez. 4 replies.
Sort Posts: Previous Next
  •  05-02-2007, 2:22 PM 1804

    Silently add printers to user pcs

    I found a script that will add a printer to a user's pc. I modified it so that you could add several at one time. The script works fine once it is on the pc that you want it run on, but the prompts come up for user input. I want it to be run on the remote pc but the input prompts come up on my pc so that this is invisible to the users. I am no good at scripting, especially on remote machines. Could soemone look at this script and tell me what I'm doing wrong??

     

    ' Printer1.vbs - Windows Logon Script.
    ' VBScript - Connect a printer with AddWindowsPrinterConnection
    ' Author Guy Thomas http://computerperformance.co.uk/
    ' Version 1.7 - June 2006
    ' Modified to add multiple printers and request server name and printer name
    ' Lino Torrez 05/02/07
    ' ------------------------------------------------------------'
    Option Explicit
    Dim num, i
    num = InputBox("How many printers do you want to add?")

    Dim objNetwork, strUNCPrinter1(20), server, printer (20)
    server = Inputbox("Server?")
    for i = 1 to num
    Printer (i) = InputBox("Printer # " & i & " Name?")
     
    strUNCPrinter1 (i) = "\\" & server & "\" & printer (i)
    ' Create a network object (not Environment or AD)
    Set objNetwork = CreateObject("WScript.Network")
    %HOST%objNetwork.AddWindowsPrinterConnection strUNCPrinter1 (i)

    ' Optional command to show where to look for your printer
     WScript.Echo "Printer " & printer (i) & " added"
    Next
    WScript.Quit

     

    Thanks guys, any help would be appreciated.

  •  05-15-2007, 11:38 AM 1838 in reply to 1804

    Re: Silently add printers to user pcs

    This can't be done the way you're trying to do it.  The script runs entirely on the remote computer, so the prompts will appear there as well.  There's no way to have the script run remotely, but the dialogs appear locally.

    The only way I could see doing it would be to accept a command line parameter and pass it along with the script.

    Unfortunately this also can't be done remotely because printer connections are user-profile-specific.

    Can I suggest using a logon script to do this?  Your script can be easily modified to run in a logon script.  Another alternative solution if you are running Windows 2000/XP/Vista Clients and a Windows 2003 R2 domain controller is to use the new Print Management tool.

  •  06-12-2007, 1:22 PM 1925 in reply to 1838

    Re: Silently add printers to user pcs

    We used to have batch files for printers & user groups that got groups of printers with batch files.
    We just started putting a few of them into the remote scripts in VNCSCAN and they work fine.

    Here's an example.
    This adds a network printer to that PC and it shows up for all users.
    You can substitute /ga with /gd to delete one.

    rundll32 printui.dll,PrintUIEntry /ga /n\\servername\printersharename
    net stop spooler
    net start spooler

  •  06-12-2007, 1:26 PM 1926 in reply to 1925

    Re: Silently add printers to user pcs

    PS- You can add multiple printers this way too. Our transcription groups has a bunch of printers setup for each of their PCs. You can just put in multiple runndll32 lines.

    Example
    rundll32 printui.dll,PrintUIEntry /ga /n\\servername\printersharename1
    rundll32 printui.dll,PrintUIEntry /ga /n\\servername\printersharename2
    rundll32 printui.dll,PrintUIEntry /ga /n\\servername\printersharename3
    rundll32 printui.dll,PrintUIEntry /ga /n\\servername\printersharename4
    rundll32 printui.dll,PrintUIEntry /ga /n\\servername\printersharename5
    net stop spooler
    net start spooler

  •  07-26-2007, 11:09 AM 2040 in reply to 1926

    Re: Silently add printers to user pcs

    Thanks
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems