title: Powershell Exchange 2010 on Windows 8
body: <p>The Follow script worked fine under win 7 with no issues, but when I loaded my app on windows 8 to see what all was broken I found that this script would no longer work correctly. Its a very simple script to load up user exchange Mailbox for searching if the user has a mailbox within a larger app. It's actually written in python because I use IronPython as a plugin system.</p>
  
  <pre><code>    password = SecureString()
      str_password = "PASSWORD"
      str_user = "EXCHUSER"
      uri = "http://" + exchangeServerIP + "/PowerShell"
  
      for c in str_password:
          password.AppendChar(c)
  
      creds = PSCredential(str_user, password)
  
      connectionInfo = WSManConnectionInfo(Uri(uri), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", creds)
  
      connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic
  
      runspace = RunspaceFactory.CreateRunspace(connectionInfo)
  
      runspace.Open()
  
      powershell = PowerShell.Create()
      powershell.AddCommand("Get-Mailbox")
      if self.txtUsername.Text != "*":
          powershell.AddParameter("Identity", self.txtUsername.Text)
  
      powershell.AddParameter("ResultSize", "Unlimited")
      powershell.Runspace = runspace
  
      results = powershell.Invoke()
  
      if results == None or results.Count &lt;= 0:
          MessageBox.Show("No mailboxes can be found!")
          runspace.Close()
          runspace.Dispose()
          powershell.Dispose()
          return
  
      self.dataGridView1.Rows.Clear()
  
      for result in results:
      &gt;&gt;&gt;&gt;&gt;&gt;&gt; if result.Properties != None:   (ERROR HERE)  &lt;&lt;&lt;&lt;&lt;&lt;&lt;
                  if result.Properties["Name"] != None:
                      if result.Properties["Name"].Value != None:
                          System.Console.WriteLine(result.Properties["Name"].Value.ToString())
  
      runspace.Dispose()
      runspace.Close()
      runspace = None
  
      powershell.Dispose()
      powershell = None
  
      connectionInfo = None
  </code></pre>
  
  <p>I have marked where I get the error saying the result.Properties is NoneType which when debugging I can see that it is populated and the correct results are there. Not sure if windows 8 / .net 4.5 is the cause of the issue but works fine under win 7 exact code no null value. Any Suggestions would help greatly.</p>
  
  <p><strong>Updated (Answer):</strong></p>
  
  <p>After constant digging I finally found that the issue was with Powershell 3. Access the Members on using Powershell 2 with IronPython I could use result.Members["Name"].Value but with Powershell 3 and the DLR, IronPython will return null value on result.Members Collection so I have to call it as result.Name. (Where result = PSObject)</p>