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

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Event ID 64,77,1008 Certificates Events Windows Server 2008, 2008R2