I'm writing a web service that executes powershell scripts (active directory, directory management, etc).
Right now, Runspace instance is created per web request. As Runspace initialization is time consuming operation, plus often I have to import modules, like ActiveDirectory, which are also slow operations.
In this blog post Managing Exchange 2007 Recipients with C# , the Runspace instance is kept in a static field.
I wander what if I keep Runspace instance in static field, would it be thread safe? Maybe there are other drawbacks of doing it this way?
Thanks