Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
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]

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us