how to add a standard printer port using Powershell WMI.


hi guys, trying add standard printer port using powershell follows :-

function createprinterport {
param ($printerip, $printerport, $printerportname, $computername)
$wmi = [wmiclass]”\\$computername\root\cimv2:win32_tcpipprinterport”
$wmi.psbase.scope.options.enableprivileges = $true
$port = $wmi.createinstance()
$port.name = $printerportname
$port.hostaddress = $printerip
$port.portnumber = $printerport
$port.snmpenabled = $false
$port.protocol = 1
$port.put()
}

the problem have want add lpr port not standard tcp/ip port. above script creates port in registry under \print\monitors\standard tcp/ip port\

but need port creating under \print\monitors\lpr port.

is there way can ?

thanks

mark green

 

help add-printerport -full

this allows direct creation of lpr ports.


\_(ツ)_/



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL

Como saber quien entro a mi PC por la Red