I'm programming some maintenance tools in VB.NET interacting with our Exchange 2010 server via PowerShell. Everything works fine but this, here's the simple code snippet:
Dim command As New Command("Get-Mailbox")
Dim pipeline = runspace.CreatePipeline()
Dim results = pipeline.Invoke()
For Each item In results
Basically, I'm calling the Get-Mailbox cmdlet with the identity switch: "Get-Mailbox -Identity <initials>"
If I run this cmdlet on the exchange server in the Powershell window directly, I get 4 results in columns:
Name / Alias / ServerName / ProhibitSendQuota
Now in my program above, my variable "results" which stores these results, is a
So I was expecting to get a collection of the same 4 results..in fact I am not.
When I loop through the collection, I only get 1 result: the 1st one, 'Name'.
How do I get/access the other results??? What I am missing or doing wrong?
I'm actually trying to get the "ServerName"...
Thank you so much for your help.