/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


How to deploy Printer VBScript/cmd in SCCM with admin rights

11/30/2016 1916 views

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

@ECHO OFF

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

    objNewPort.Put_

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 = ""

    objPrinter.Put_

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   [ + ] Show comments

Comments


All Answers

1
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!!

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ