Alex Rivera | Logout

Send administrative commands to my C# Windows Service using own PowerShell CmdLets

Asked 2008-10-25T22:09:18.380
9

I have a C# Windows application which runs a service. I would like to leverage PowerShell in order to offer a command line management interface for administering my running service.

From my point of view, I am trying to offer the same administrative interface a la Exchange 2007.

Do you have any suggestion or sample code on how to start/design the management cmdlets in order "connect" to the running service to query or send administrative commands?

How can I access service's internal runtime state from powershell command line? For example I would like to implement a cmdlet called Get-ConnectionsInfo to find out how many outbound connections my Windows service is using when the cmdlet is executed.

A practical example or web link to an example would be more than welcomed.

Thanks, Robert

Edit
Report

1 Answer

0

Another way of exposing the internal state of the Windows Service came to mind. You could expose information through WMI which can be consumed from PowerShell or your PowerShell commands.

I'm not sure if you are able to tell your service to perform actions through WMI but you would at least be able to pull out state.

answered 2008-10-26T11:08:17.933

Your Answer