There are so many questions and answers about how to execute a powershell script from C# code, but I would like to know how exactly the runspace/pipeline performs the execution of the .ps1 file.
The context in which I am asking is this: I've built a basic asp.net front end for a powershell script that sets up a new website. It creates the site in IIS and sets up wwwroot folders, log folders, an AD user and everything else that it needs. It works perfectly when I run it as an admin in powershell. However, when I run it through my C# pipeline, it breaks the pipe with a parameter binding exception.
I'm not after an answer to this specific problem, I'm just looking for an explanation of how the pipeline executes my file so that I can have a better understanding of what exactly is going on.
As the liquid refrigerant inside the evaporator coil converts to gas, heat from the indoor air is absorbed into the refrigerant, thus cooling the air as it passes over the coil. The indoor unit's blower fan then pumps the chilled air back through the home's ductwork out into the various living areas.
It's not a complete explanation of how the runspace works, but I've written a blog post covering the main bits.
Also a snippet from one of the msdn pages on how powershell works:
The Powershell runtime is invoked as a runspace and will, by default, process commands synchronously and deliver the results of processing to the host application so that they can be returned to the user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With