To invoke a PowerShell script with parameters from C# in JavaScript, you can use the PowerShell class in C# and the System.Management.Automation namespace. Here's an example code snippet:
main.cs538 chars20 lines
This code will invoke the PowerShell script located at C:\Scripts\MyScript.ps1
with two parameters (Param1
and Param2
) and display the results of the script in the console window.
Make sure to add the System.Management.Automation
assembly as a reference to your project in Visual Studio before using the PowerShell
class.
gistlibby LogSnag