Print

Powershell script to add printer ports server 2008

Posted in Printers

The following script will create printer TCP/IP ports for Windows 2008, if you perform this same task via GUI the wizard will attempt to query the port and take minutes to time out if you have not setup the printer yet. (Quite common for me when doing server migrations offsite).

 

#Change the IP address to create a port without the TCPIP scan wait

$ip = "10.X.X.X"
$port = [wmiclass]"Win32_TcpIpPrinterPort"
$port.psbase.scope.options.EnablePrivileges = $true
$newPort = $port.CreateInstance()
$newport.name = "$ip"
$newport.Protocol = 1
$newport.HostAddress = $ip
$newport.PortNumber = "9100"
$newport.SnmpEnabled = $false
$newport.Put()