Creat Print Server Ports and Names

Welcome Forums General PowerShell Q&A Creat Print Server Ports and Names

Viewing 2 reply threads
  • Author
    Posts
    • #180881
      Participant
      Topics: 1
      Replies: 1
      Points: 20
      Rank: Member

      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?

      eg.,

       

      IP                    Name

      10.0.0.0         PortName1

       

      Kindest Regards,

       

      Matt

    • #180950
      Participant
      Topics: 6
      Replies: 108
      Points: 304
      Helping Hand
      Rank: Contributor

      This may be a pretty good starting point: https://lazyadmin.nl/powershell/install-a-printerport-and-printer-with-powershell/

      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.

    • #180998
      Participant
      Topics: 1
      Replies: 1
      Points: 20
      Rank: Member

      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 }

       

Viewing 2 reply threads
  • The topic ‘Creat Print Server Ports and Names’ is closed to new replies.