title: How to access NoteProperties on the InputObject to a remoting session
body: <p>I'm having difficulty accessing <code>PSObject</code>s with NoteProperties defined, that are being passed through to a remote session via <code>Invoke-Command</code>.  The reason I am constructing an object for this purpose is that I need access to two separate pieces of information in the remote session, but PowerShell only provides for a single <code>InputObject</code>.  </p>
  
  <p>My code looks something like this:</p>
  
  <pre><code>$sessionInput = new-object -TypeName System.Object
  $sessionInput | Add-Member -MemberType NoteProperty -Name NoteProperty1 -Value @("some", "value")
  $sessionInput | Add-Member -MemberType NoteProperty -Name NoteProperty2 -Value @("some", "other", "value)
  $session = New-PSSession -ComputerName my-computer -Credential (Get-Credential)
  Invoke-Command -Session $session -InputObject $sessionInput {
      $input #1
      $input | Get-Member #2
      $input.NoteProperty1 #3
      $input.NoteProperty1 | Get-Member #4
  }
  </code></pre>
  
  <p>I get the following output for each of the numbered lines above.</p>
  
  <h2>1. <code>$input</code></h2>
  
  <p>So, first of all I tried my usual technique of dumping the variable to the console, which confirmed that the properties were passed through with the expected value:</p>
  
  <pre><code>NoteProperty1      : {some, value}
  NoteProperty2      : {some, other, value}
  PSComputerName     : my-computer
  RunspaceId         : d1f35c8b-f631-4caa-bae0-f7c0066bbd55
  PSShowComputerName : True
  </code></pre>
  
  <h2>2. <code>$input | Get-Member</code></h2>
  
  <p>This generated slightly more information than the previous attempt:</p>
  
  <pre><code>   TypeName: Deserialized.System.Object
  
  WARNING: column "PSComputerName" does not fit into the display and was removed.
  
  Name          MemberType   Definition                                                                                       
  ----          ----------   ----------                                                                                       
  Equals        Method       bool Equals(System.Object obj)                                                                   
  GetHashCode   Method       int GetHashCode()                                                                                
  GetType       Method       type GetType()                                                                                   
  ToString      Method       string ToString(), string ToString(string format, System.IFormatProvider formatProvider)         
  NoteProperty1 NoteProperty Deserialized.System.String[] NoteProperty1=some val...
  NoteProperty2 NoteProperty Deserialized.System.String[] NoteProperty2=some oth...
  </code></pre>
  
  <p>Note that the last two lines clearly show the NoteProperty is present on the object received by the remote session.  All those mentions of <code>Deserialized</code> are starting to pique my interest...</p>
  
  <h2>3. <code>$input.NoteProperty1</code></h2>
  
  <p>Having had some luck with the first two, I started trying to inspect <code>NoteProperty1</code> itself.  However, the value of this property appears to be null; nothing is written to the console using the line above, <code>$input.NoteProperty1 -eq $null</code> returns True.  </p>
  
  <h2>4. <code>$input.NoteProperty1 | Get-Member</code></h2>
  
  <p>So, last of all, I tried to inspect the <code>NoteProperty1</code> value directly via <code>Get-Member</code>, which failed miserably with the message "No object has been specified to the get-member cmdlet.", which is consistent with a null object being passed to Get-Member.</p>
  
  <h2>Help!</h2>
  
  <p>So, I'm completely at a loss now: this Schrödinger property both exists and does not; both has the expected value, and has no value.  I think I can write this in a slightly different way that will eliminate the need for the NoteProperties, but I would love to know what's going on here!</p>