→ 🚀What's New? Explore Lansweeper's Fall 2024 Updates! Fall Launch Blog !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Finchc
Engaged Sweeper
I am trying to create a custom action to add 4 network print queues to Windows PC's remotely.  I am using the VBS script file below and calling it with the command {actionpath}printer.vbs {computer}.  The script appears to work when run locally, but not remotely. Can someone tell me what I'm doing wrong here?
 
Option Explicit

Dim objNetwork, strPrinter1, strPrinter2, strPrinter3, strPrinter4

' Define the names of the printers you want to add
strPrinter1 = "\\print-rsc\HP-BW"
strPrinter2 = "\\print-rsc\HP-Color"
strPrinter3 = "\\print-rsc\ToshibaBW"
strPrinter4 = "\\print-rsc\ToshibaColor"

' Create a WScript.Network object
Set objNetwork = CreateObject("WScript.Network")

' Add each printer using the AddWindowsPrinterConnection method
objNetwork.AddWindowsPrinterConnection strPrinter1
objNetwork.AddWindowsPrinterConnection strPrinter2
objNetwork.AddWindowsPrinterConnection strPrinter3
objNetwork.AddWindowsPrinterConnection strPrinter4

' Display a message indicating that printers have been added
MsgBox "Printers added successfully.", vbInformation, "Printers Added"

' Clean up
Set objNetwork = Nothing
1 REPLY 1

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now