title: Invoke-RestMethod post complex type object as Body not work
body: <p>I am using PowerShell V4, with the <code>Invoke-RestMethod</code> command:</p>
  
  <pre><code>Add-Type @"
      using System;
  
      public class Person{
          public Guid Id {get;set;}
          public string Name {get;set;}
          public int Age {get;set;}
      }
  "@
  $person = New-Object Person
  $person.Age = [int]::(Get-Random -Maximum 99 -Minimum 20)
  $person.Name = [string]::("Test" + (Get-Random -Minimum 10 -Maximum 100))
  
  Invoke-RestMethod -Uri "http://localhost:51624/api/personapi" -Method Post -Body $person
  </code></pre>
  
  <p>In the server side,</p>
  
  <pre><code>[HttpPost]
  public IHttpActionResult Post(Person person)
  {
      ...
  
      return Ok();
  }
  </code></pre>
  
  <p>The <code>person</code> object received in server side is all properties default, for instance the <code>Age</code> is <code>0</code> and <code>Name</code> is <code>null</code>. If I change <code>$person</code> to <code>@{Name="..."; Age=11}</code> then it's ok.</p>
  
  <p>Did I miss something, I want to hold the class definition?</p>