Is there any problems with creating a powershell runspace in an asp.net application and running commands?
I have a basic example working fine but I’m wondering if there are any pitfalls waiting for me.
I’m particularly wondering:
- Is this an a light-weight inprocess operation or is it firing up another processes that could lead to unpredictable behaviour.
As long as you’re not shelling out to powershell.exe explicitly, instead using
RunspaceandPipelineobjects directly, you can be assured it’s fairly lightweight. Btw, if you are trying to interact with cmdlets through C#, only cmdlets that derive fromPSCmdletneed a pipeline; ones that derive fromCmdletdirectly can be called without a pipeline via the Invoke method. This is the most lightweight approach.