diff --git a/Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs b/Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs index 46d6e63..ae4c8fb 100644 --- a/Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs +++ b/Frends.PowerShell.RunCommand/Frends.PowerShell.RunCommand/PowerShell.cs @@ -104,6 +104,7 @@ private static PowerShellResult ExecuteProcess(string scriptPath, PowerShellPara } finally { + if (!process.HasExited) process.Kill(); process.Close(); } diff --git a/Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/PowerShell.cs b/Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/PowerShell.cs index 21f01ca..a808af9 100644 --- a/Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/PowerShell.cs +++ b/Frends.PowerShell.RunScript/Frends.PowerShell.RunScript/PowerShell.cs @@ -103,6 +103,7 @@ private static PowerShellResult ExecuteProcess(string scriptPath, PowerShellPara } finally { + if (!process.HasExited) process.Kill(); process.Close(); }