Package io.github.gageallencarpenter
Class Powershell
java.lang.Object
io.github.gageallencarpenter.Powershell
The Powershell class provides a convenient way to execute PowerShell scripts synchronously or asynchronously.
- Author:
- Gage
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of Powershell with the maximum number of threads based on the runtime environment.Powershell(int threads) Creates an instance of Powershell with a specified number of threads. -
Method Summary
-
Constructor Details
-
Powershell
public Powershell()Creates an instance of Powershell with the maximum number of threads based on the runtime environment. -
Powershell
public Powershell(int threads) Creates an instance of Powershell with a specified number of threads.- Parameters:
threads- the number of threads allocated to this Powershell instance
-
-
Method Details
-
execute
Executes a PowerShell script synchronously.- Parameters:
script- the PowerShell script to execute- Returns:
- the list of output lines from the script execution
-
executeAsync
Executes a PowerShell script asynchronously.- Parameters:
script- the PowerShell script to execute- Returns:
- a Future representing the asynchronous execution with the result containing the list of output lines
- Throws:
RuntimeException- if an IOException occurs during the script execution
-