title: Set service contract object property programmatically using Powershell
body: <p>I have a service I'm consuming using the <code>New-WebServiceProxy</code> cmdlet. This service contract contains custom serializable objects.</p>
  
  <p>An example of one of these objects may be defined as:</p>
  
  <pre><code>public class Person
  {
      public string FirstName { get; set; }
      public string LastName { get; set; }
  }
  </code></pre>
  
  <p>Or, in Powershell using <code>Get-Member</code>:</p>
  
  <pre><code>Name      MemberType Definition
  ----      ---------- ----------
  FirstName Property   string FirstName {get;set;}
  LastName  Property   string LastName {get;set;}
  </code></pre>
  
  <p><strong>Note:</strong> I do not control this web service, it is a third-party closed-source service. I am only consuming it.</p>
  
  <p>I want to be able to modify property values using Powershell. If I have a <code>Person</code> instance called <code>$person</code>, and I try this:</p>
  
  <pre><code>$person | Set-ItemProperty -Name FirstName -Value John
  </code></pre>
  
  <p>The following error occurs:</p>
  
  <blockquote>
    <p><em>The input object cannot be bound to any parameters for the command either because the  command does not take pipeline input or the input and its properties do not match any of  the parameters that take pipeline input.</em></p>
  </blockquote>
  
  <p>Whereas if I just do this:</p>
  
  <pre><code>$person.FirstName = 'John'
  </code></pre>
  
  <p>It works fine.</p>
  
  <p>How can I programmatically set property values on this service object?</p>