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
Post a Comment