title: Looping through each NoteProperty in a custom object
body: <p>I'm creating a <code>PSObject</code> in Powershell like this:</p>
  
  <pre><code>$NetworkInfo = New-Object PSObject
  $NetworkInfo | Add-Member -type NoteProperty -Name IPAddress -Value "10.10.8.11"
  $NetworkInfo | Add-Member -type NoteProperty -Name SubnetMask -Value "255.255.255.0"
  $NetworkInfo | Add-Member -type NoteProperty -Name Gateway -Value "10.10.8.254"
  $NetworkInfo | Add-Member -type NoteProperty -Name Network -Value "10.10.8.0"
  $NetworkInfo | Add-Member -type NoteProperty -Name DNS1 -Value "10.10.10.200"
  $NetworkInfo | Add-Member -type NoteProperty -Name DNS2 -Value "10.10.10.201"
  
  $NetworkInfo
  </code></pre>
  
  <p>I want to do a specific action for each NoteProperty in this PSObject, but I'm not sure how to go about doing that.  For example (even though I know it's the wrong way to do it) this code:</p>
  
  <pre><code>  ForEach ($noteProperty in $NetworkInfo) {
      Write-Host $noteProperty
    }
  </code></pre>
  
  <p>Only outputs the entire object as an array:</p>
  
  <pre><code>@{IPAddress=10.10.8.11; SubnetMask=255.255.255.0; Gateway=10.10.8.254; Network=10.10.8.0; DNS1=10.10.10.200; DNS2=10.10.10.201}
  </code></pre>
  
  <p>EDIT: Each <code>NoteProperty</code> is of the variable type <code>System.String</code> - if that's pertinent.</p>
  
  <p>Am I creating the object incorrectly, or do I just not understand how to go through the object?</p>