title: PowerShell Multiple Input IP Addresses
body: <p>I have an issue with multiple input in this code:</p>
  
  <pre><code>cls
  Install-Module SNMP
  Get-Command -Module SNMP
  
  Write-Output ----------------------------------------
  $IP = "192.168.15.1"
  Write-Output ----------------------------------------
  Write-Output "Selected IP is: $IP"
  Write-Output ----------------------------------------
  
  Invoke-SnmpWalk -IP $IP -Community public -OID .1.3.6.1.2.1.2.2.1.2  | Format-Table Data -AutoSize -HideTableHeaders | Out-File C:\NameP.ps1xml 
  
  Get-Content C:\NameP.ps1xml  | Where { $_ -ne ""  } | Set-Content C:\NameP1.ps1xml 
  $Ports = @(Get-Content C:\NameP1.ps1xml | Where-Object { $_.StartsWith("Unit") } )
  $NumberOfports = @(Get-Content C:\NameP1.ps1xml | Where-Object { $_.StartsWith("Unit") } ).Count
  
  Write-Output ----------------------------------------
  Write-Output "Name ports: "$Ports  
  Write-Output ----------------------------------------
  Write-Output "Number of ports:  $NumberOfports"
  </code></pre>
  
  <p>This is for one IP address of switch and a I need to go through multiple switches of one production with different IP addresses for example 192.168.16.1, 192.168.17.1 suddenly with one script with list of IP or something like that. </p>
  
  <p>My output:</p>
  
  <pre><code> CommandType     Name                                               Version    Source     
  -----------     ----                                               -------    ------     
  Function        Get-SnmpData                                       1.0.0.1    SNMP       
  Function        Invoke-SnmpWalk                                    1.0.0.1    SNMP       
  Function        Set-SnmpData                                       1.0.0.1    SNMP       
  ----------------------------------------
  ----------------------------------------
  Selected IP is: 192.168.15.1
  ----------------------------------------
  ----------------------------------------
  Name of ports: 
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 1                   
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 2                   
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 3                   
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 4                   
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 5                   
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 6                   
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 7                   
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 8                   
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 9                   
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 10                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 11                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 12                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 13                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 14                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 15                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 16                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 17                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 18                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 19                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 20                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 21                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 22                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 23                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 24                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 25                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 26                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 27                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 28                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 29                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 30                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 31                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 32                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 33                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 34                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 35                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 36                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 37                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 38                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 39                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 40                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 41                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 42                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 43                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 44                  
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 45 - no sfp inserted
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 46 - no sfp inserted
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 47 - no sfp inserted
  Unit: 1 1000BASE-T RJ45 Gigabit Ethernet Frontpanel Port 48 - no sfp inserted
  ----------------------------------------
  Number of ports:  48
  </code></pre>
  
  <p>I want this output for more IPs. Do you have any simple solution that would go through multiple IP addresses? 
  Then I still work with these data. 
  Thanks for every idea.</p>