I'm having trouble with the following script. It works when run locally. When I run it through SCCM nothing happens.


REM Create Port
cscript Prnport.vbs -a -r IP_10.x.x.x -h 10.x.x.x -o raw -n 9100

REM Install Driver
cscript Prndrvr.vbs -a -m "Xerox WorkCentre 5700 Series Class Driver" -h "%~dp0\Xerox WorkCentre 5700 Series Class Driver" -i "%~dp0\x2UNIVX.inf"

REM Create Printer
cscript prnmngr.vbs -a -p "SUP140" -m "Xerox WorkCentre 5700 Series Class Driver" -r IP_10.x.x.x


I also have another script that works locally but not through SCCM. It



''                                              ''

''   Script to automate TCP/IP printer installs ''

''                                              ''



Set WSHNetwork = WScript.CreateObject("WScript.Network")

set shell = WScript.CreateObject( "WScript.Shell" )

CompName = shell.ExpandEnvironmentStrings("%COMPUTERNAME%")

Set objWMIService = GetObject("winmgmts:\\" & CompName & "\root\cimv2")

Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_

Set oShell = WScript.CreateObject("WScript.shell")

Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_

sub createPort (name, ip)

    objNewPort.Name = name

    objNewPort.Protocol = 1

    objNewPort.HostAddress = ip

    objNewPort.SNMPEnabled = False


end sub

sub addPrinter (driver, port, name)

    objPrinter.DriverName = driver

    objPrinter.PortName = port

    objPrinter.DeviceID = name

    objPrinter.Location = "Xerox WorkCentre 5700 Series Class Driver"

    objPrinter.Network = True

    objPrinter.Shared = false

    objPrinter.ShareName = ""


end sub


'Add printer ports:'


createPort "Xerox WorkCentre 5700 Series Class Driver", "10.x.x.x"


'Install printers with drivers native to WinXP:'


'                                                TCP/IP Port Name        Display Name

'                                                --------------------    -----------------

addPrinter "Xerox WorkCentre 5700 Series Class Driver",        "Xerox WorkCentre 5700 Series Class Driver",         "SUP140"

'msgbox ("Printer installation complete.  Don't Forget to make it the default printer")

This script generates an WEBem permission error.

0 Comments   [ - ] Hide Comments


Please log in to comment

Answer this question or Comment on this question for clarity


It is probably due to network printers are a per user item.  You would need to deploy as current user..  You can push the vbscript to the machines and then modify the run once key to install on next boot.
Answered 11/30/2016 by: SMal.tmcc
Red Belt

  • Changing the Deployment Type-User Experience to Install for User solved the problem. Thank you!!
Please log in to comment