diff --git a/src/Artemis.Core/Plugins/Prerequisites/PrerequisiteAction/RunInlinePowerShellAction.cs b/src/Artemis.Core/Plugins/Prerequisites/PrerequisiteAction/RunInlinePowerShellAction.cs
index 08f6e63ca..c291b81a3 100644
--- a/src/Artemis.Core/Plugins/Prerequisites/PrerequisiteAction/RunInlinePowerShellAction.cs
+++ b/src/Artemis.Core/Plugins/Prerequisites/PrerequisiteAction/RunInlinePowerShellAction.cs
@@ -15,10 +15,15 @@ namespace Artemis.Core
/// The name of the action
/// The inline code to run
/// A boolean indicating whether the file should run with administrator privileges
- public RunInlinePowerShellAction(string name, string code, bool elevate = false) : base(name)
+ ///
+ /// Optional arguments to pass to your script, you are responsible for proper quoting etc.
+ /// Arguments are available in PowerShell as $args[0], $args[1] etc.
+ ///
+ public RunInlinePowerShellAction(string name, string code, bool elevate = false, string? arguments = null) : base(name)
{
Code = code;
Elevate = elevate;
+ Arguments = arguments;
ProgressIndeterminate = true;
}
@@ -32,6 +37,12 @@ namespace Artemis.Core
///
public bool Elevate { get; }
+ ///
+ /// Gets optional arguments to pass to your script, you are responsible for proper quoting etc.
+ /// Arguments are available in PowerShell as $args[0], $args[1] etc.
+ ///
+ public string? Arguments { get; }
+
///
public override async Task Execute(CancellationToken cancellationToken)
{
@@ -57,7 +68,7 @@ namespace Artemis.Core
ShowProgressBar = true;
ProgressIndeterminate = true;
- int result = await ExecuteFileAction.RunProcessAsync("powershell.exe", $"-File {file}", Elevate);
+ int result = await ExecuteFileAction.RunProcessAsync("powershell.exe", $"-File {file} {Arguments}", Elevate);
Status = $"PowerShell exited with code {result}";
}
diff --git a/src/Artemis.Core/Plugins/Prerequisites/PrerequisiteAction/RunPowerShellAction.cs b/src/Artemis.Core/Plugins/Prerequisites/PrerequisiteAction/RunPowerShellAction.cs
index 8255328ee..4ace34904 100644
--- a/src/Artemis.Core/Plugins/Prerequisites/PrerequisiteAction/RunPowerShellAction.cs
+++ b/src/Artemis.Core/Plugins/Prerequisites/PrerequisiteAction/RunPowerShellAction.cs
@@ -16,10 +16,15 @@ namespace Artemis.Core
/// The name of the action
/// The full path of the script to run
/// A boolean indicating whether the file should run with administrator privileges
- public RunPowerShellAction(string name, string scriptPath, bool elevate = false) : base(name)
+ ///
+ /// Optional arguments to pass to your script, you are responsible for proper quoting etc.
+ /// Arguments are available in PowerShell as $args[0], $args[1] etc.
+ ///
+ public RunPowerShellAction(string name, string scriptPath, bool elevate = false, string? arguments = null) : base(name)
{
ScriptPath = scriptPath;
Elevate = elevate;
+ Arguments = arguments;
ProgressIndeterminate = true;
}
@@ -33,6 +38,12 @@ namespace Artemis.Core
///
public bool Elevate { get; }
+ ///
+ /// Gets optional arguments to pass to your script, you are responsible for proper quoting etc.
+ /// Arguments are available in PowerShell as $args[0], $args[1] etc.
+ ///
+ public string? Arguments { get; }
+
///
public override async Task Execute(CancellationToken cancellationToken)
{
@@ -45,7 +56,7 @@ namespace Artemis.Core
ShowProgressBar = true;
ProgressIndeterminate = true;
- int result = await ExecuteFileAction.RunProcessAsync("powershell.exe", $"-File {ScriptPath}", Elevate);
+ int result = await ExecuteFileAction.RunProcessAsync("powershell.exe", $"-File {ScriptPath} {Arguments}", Elevate);
Status = $"PowerShell exited with code {result}";
}