1

I would like to create PowerShell cmdlets that interact with my application at runtime. Are there any best practices on how to accomplish this?

5
  • what exactly you want to do between powershell and your application? Commented Nov 6, 2013 at 0:21
  • i would like to execute some methods defined in my application and pass to them the output from standard powershell commands Commented Nov 6, 2013 at 0:28
  • it is possible to execute your application from powershell, you can pass parameters from powershell to your application also. Additionally, you can execute powershell commands from your application like string powershellcommand = "tree"; System.Diagnostics.Process.Start("powershell.exe", powershellcommand); Commented Nov 6, 2013 at 0:47
  • Are you expecting these commands to interact with a already running instance of your application or are you wanting your application to just be a powershell commandlet? Commented Nov 6, 2013 at 1:08
  • I want these commands to interact with my application at runtime Commented Nov 6, 2013 at 13:30

1 Answer 1

3

There are several options. You could some form of IPC mechanism: named pipes, memory mapped files, MSMQ, etc. The cmdlets could communicate to the app via a socket. If the app is managed, it could host a WCF endpoint that the cmdlets could use to communicate with the app. You could also expose a COM API and then control the app via that API. I'm sure there are several other ways I've failed to mention.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.