Problem using PSEXEC to install Printer RRS feed

  • Question

  • I dont know if I'm in the right place posting this, but I would really appreciate anyone's help. I mounted a script to perform the installation of a printer on the terminal using the following VBS:


    Option Explicit
    Dim netPrinter, UNCpath
    Dim hostdest,impressora
    hostdest = wscript.arguments(0)
    impressora = wscript.arguments(1)
    UNCpath = "\\" & hostdest & "\" & impressora
    wscript.echo UNCpath
    Dim oShell 
    Set oShell = CreateObject("WScript.Shell") 
    Set netPrinter = CreateObject("WScript.Network") 
    Wscript.Sleep 1000 
    netPrinter.AddWindowsPrinterConnection UNCpath 
    Wscript.Sleep 1000 
    netPrinter.SetDefaultPrinter UNCpath 


    I need to run this installation through PSEXEC. The problem is that when running the installation by PSEXEC, the printer installation only stays on the user I am using to authenticate to PSEXEC. How can I run it through PSEXEC so that the printer is available to all users who download the machine?

    My PSEXEC:
    "\\\Segurança da Informação\BATS\Tools\PsExec.exe" \\%hostdest%  -c -f -h -u %user% -P %pass% cscript "\\\Segurança da Informação\BATS\sp\MapSharedPrinter.vbs" %hostimp% "%line%"

    user=admin user
    pass=password admin
    hostdest=This is the ip of the machine that will do the mapping
    hostimp=This is the ip of the machine that owns the shared printer
    line=name of the shared printer

    Sunday, September 2, 2018 5:57 PM