|
|
|
date: Mon, 28 Apr 2008 09:33:01 -0700,
group: microsoft.public.exchange.development
back
Retrieving Exchange Server 2007 Info via the Cmdlets from C#
I'm trying to retrieve info about an Exchange 2007 server using the
'Get-ExchangeServer' cmdlet from a C# app. I am NOT referencing any of the
Microsoft.Exchange.Data.* dlls, even though that would make my coding much
easier! The problem I'm having is how can I extract specific information
from the returned PSObject, such as the AdminDisplayVersion? I am able to
retrieve the ToString() value for this entity, but I need the actual
'members' of the AdminDisplayVersion, which is actually a ServerVersion
object. As I'm not including any references, I do not know how to cast the
returned PSObject.BaseObject to a ServerVersion. I am able to cast any of
the builtin objects (like int, string, bool, etc) from the returned PSOBject,
but how to fetch anything other than those kinds of items is baffling me.
Any help / thoughts / info would be appreciated.
Rob Jones
date: Mon, 28 Apr 2008 09:33:01 -0700
author: Rob Jones Rob
Re: Retrieving Exchange Server 2007 Info via the Cmdlets from C#
Hello,
if you don't want to reference the actual assemblies you'll need to use
reflection to get the property values. See the
GetType().GetProperty("name").GetValue method.
Kind regards,
Henning Krause
"Rob Jones" <Rob Jones@discussions.microsoft.com> wrote in message
news:9C87D44E-2318-4D9E-B699-676982E27747@microsoft.com...
> I'm trying to retrieve info about an Exchange 2007 server using the
> 'Get-ExchangeServer' cmdlet from a C# app. I am NOT referencing any of
> the
> Microsoft.Exchange.Data.* dlls, even though that would make my coding much
> easier! The problem I'm having is how can I extract specific information
> from the returned PSObject, such as the AdminDisplayVersion? I am able to
> retrieve the ToString() value for this entity, but I need the actual
> 'members' of the AdminDisplayVersion, which is actually a ServerVersion
> object. As I'm not including any references, I do not know how to cast
> the
> returned PSObject.BaseObject to a ServerVersion. I am able to cast any of
> the builtin objects (like int, string, bool, etc) from the returned
> PSOBject,
> but how to fetch anything other than those kinds of items is baffling me.
>
> Any help / thoughts / info would be appreciated.
>
> Rob Jones
date: Mon, 28 Apr 2008 19:01:24 +0200
author: Henning Krause [MVP - Exchange]
|
|