Run Exchange Management Shell cmdlets from Visual Basic/C#/.NET app
Posted
by nowarninglabel
on Stack Overflow
See other posts from Stack Overflow
or by nowarninglabel
Published on 2010-04-14T22:38:42Z
Indexed on
2010/04/14
22:43 UTC
Read the original article
Hit count: 332
Goal: Provide a web service using Visual Basic or C# or .NET that interacts with the Exchange Management Shell, sending it commands to run cmdlets, and return the results as XML. (Note that we could use any lanaguage to write the service, but since it is a Windows Box and we have Visual Studio 2008, it seemed like easiest solution would be just use it to create a VB/.NET web service. Indeed, it was quite easy to do so, just point and click.)
Problem: How to run an Exchange Management Shell cmdlet from the web service, e.g, Get-DistributionGroupMember "Live Presidents"
Seems that we should be able to create a PowerShell script that runs the cmdlet, and be able to call that from the command line, and thus just call it from within the program. Does this sound correct? If so how would I go about this? Thanks. Answer can be language agnostic, but Visual Basic would probably be best since that is what I loaded the test web service up in.
© Stack Overflow or respective owner