Creat Print Server Ports and Names

Good Day,

I am very noobish to PowerShell, but I’m trying my best to learn.

I have a printer server named PAPER01. I have a list of I.P. addresses. I would like to create a TCP/IP port for each I.P. address and name the port. I have a list of names that corrospond to the I.P. address.

What would a script look like that creates a port from a CSV list of I.P.s and name the ports to the desired name?



IP Name PortName1


Kindest Regards,



This may be a pretty good starting point: Install a Printerport and Printer with PowerShell — LazyAdmin

It sounds like it will just be a loop through your CSV and for each record you’ll build and execute an Add-PrinterPort cmdlet.

Here is what I ended up doing that worked for me:


#Create a variable for the IPs from a .txt file

$IPsA = get-content c:\temp\ip.txt

#Once the variable has been made create an argument to create a port from each IP and name it the IP.

ForEach ($IP in $IPsA) {add-printerport -printerhostname $IP -name $IP -computername <servername>}