I attempting to add some fairly limited PowerShell support in my application: I want the ability to periodically run a user-defined PowerShell script and show any output and (eventually) be able to handle progress notification and user-prompt…
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…
Is there any sane, reliable contract that dictates whether Write-Host is supported in a given PowerShell host implementation, in a script that could be run against any reasonable host implementation?
(Assume that I understand the difference between…
Scenario: Windows service with Powershell host embedded into it. Single runspace is allocated at startup. Multi-dll solution.
Requirement: Need to access .NET classes inside running service. From a local Powershell instance using…
I am hosting powershell within my app and have set up a restricted runspacepool, which is basically empty (to the best of my knowledge).
public class MyPowerShell : IDisposable
{
private RunspacePool _runspacePool;
private PowerShell…
I need CLI for our asp.net mvc application to perform maintenance tasks and some status tasks.
I think powershell is designed to provide CLI. But i do not know anything about it other than name.
How can i host powershell in asp.net mvc running in…
PowerShell 4.0
I want to host PowerShell engine in my application and to have the capability of using API of my application in the hosted PowerShell. I read the description of the PowerShell class and its members in the documentation. In the…
I'm working on an application to have Powershell embedded in it. I'm wondering if there is a way I can launch a separate Powershell command window, and interact with my application through this Powershell window? Can anyone point out some reference?…
I need to launch the cmdled in PowerShell is hosted inside of AutoCAD. Assemblies of AutoCAD (it is host of PowerShell) are not in GAC. How can I correctly to point the assemblies of AutoCAD? Is it possible to point the set of the DLL files instead…
Having the following NET 5 Console application:
static void Main(string[] args)
{
using var ps = PowerShell.Create();
// ps.AddCommand("Get-Service");
ps.AddStatement().AddCommand("Get-Service");
ps.Invoke();
}
The calls seems to be…
Is there a way to find functions that were imported into an InitialSessionState using ImportPSModule()?
I have this wrapper around PowerShell to run scripts self-hosted by my applicaton (comments and error checking removed for brevity)
public class…
I am trying to build a C# console app that executes a series of PowerShell commands that run against an Azure Subscription.
var line1 = "$cred = Get-Credential"
var line2 = "Add-AzureAccount -Credential $cred"
var psi =…
PowerShell 4.0
In my application the Application class has the set of important properties, methods, and events. I want to work with that members through the app PowerShell variable (it would be like the alias of the class). But the…
I've done some work hosting PowerShell and have done a lot of reading but I am seeing strange behavior and it makes me wonder if I do not understand the host like I thought I did.
I am creating a Runspace with RunspaceFactory:
var runSpace =…
I'm building a PowerShell host in VS 2012, currently in a C# (.NET 4.5) Console Project. The project is configured for Any CPU and 'Prefer 32-bit' is not checked. I've added a reference to System.Management.Automation manually by adding
…