21Dec
Posted by admin as .Net, C#, PowerShell, Visual Studio
When running a PowerShell script using a RunSpace in .Net there might be several occasions where you need to import a module to run your script. They are two different ways to achieve this. Simplest way is to include the “Import-Module” statement as a part of your command. For example..
Collection<PSObject> RunPowerShellScript()
[...]
13Dec
Posted by admin as .Net, C#, PowerShell
Lets see how can we run a PowerShell script (.ps1) file from .Net using PowerShell runspaces. I assume that you have already installed latest version of PowerShell on your machine. Now add the “System.Management.Automation.dll” to the references of you project by right clicking on the references node of the project in solution explorer and browsing [...]