Skip to content

Commit b898ee7

Browse files
authored
Updates from editor
1 parent 5ac1611 commit b898ee7

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

support/power-platform/power-automate/desktop-flows/failed-to-run-powershell-script-error.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
title: Failed To Run PowerShell Script Error
2+
title: Failed to Run PowerShell Script Error
33
description: Solves an error that occurs when you run the Run PowerShell script action in a desktop flow in Microsoft Power Automate for desktop.
44
ms.author: iomavrid
55
author: yiannismavridis
66
ms.custom: sap:Desktop flows
7-
ms.date: 04/16/2025
7+
ms.date: 04/18/2025
88
---
99
# "Failed to run PowerShell script" error when running the Run PowerShell script action
1010

1111
This article provides a resolution for an error that occurs when running the [Run PowerShell script](/power-automate/desktop-flows/actions-reference/scripting#runpowershellscript) action in Microsoft Power Automate for desktop.
1212

1313
## Symptoms
1414

15-
During the execution of a desktop flow in Power Automate for desktop, an error occurs message when running the **Run PowerShell script** action. This issue might also occur after a recent Windows update.
15+
During the execution of a desktop flow in Power Automate for desktop, an error occurs when running the **Run PowerShell script** action. This issue might also occur after a recent Windows update.
1616

1717
The error message appears as follows:
1818

@@ -27,12 +27,12 @@ Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Failed to run PowerShell
2727

2828
## Cause
2929

30-
The **Run PowerShell script** action internally starts an instance of `powershell.exe` and provides the script specified in the action's input as an argument to the process. If the system fails to find `powershell.exe`, you might receive the error message.
30+
The **Run PowerShell script** action internally starts an instance of `powershell.exe` and provides the script specified in the action's input as an argument for the process. If the system fails to find `powershell.exe`, you might receive the error message.
3131

3232
The most likely cause of this issue is that the **Path** environment variable doesn't include the directory containing the `powershell.exe` executable. To confirm this as the root cause, follow these steps:
3333

3434
1. Open a Command Prompt (CMD) window.
35-
1. Run `powershell.exe` by typing the command and pressing Enter.
35+
1. Run `powershell.exe` by typing the command and pressing **Enter**.
3636

3737
If the following message occurs, then the issue lies in the missing path to `powershell.exe` in the **Path** environment variable.
3838

@@ -42,19 +42,17 @@ If the following message occurs, then the issue lies in the missing path to `pow
4242

4343
To resolve this issue, follow these steps to update the **Path** environment variable to include the directory of the `powershell.exe` executable:
4444

45-
1. Open the Start menu and search for "Environment Variables." Select **Edit the system environment variables**.
45+
1. Open the Start menu, search for **Environment Variables**, and then select **Edit the system environment variables**.
4646

4747
1. In the **System Properties** window, select **Environment Variables**.
4848

49-
1. Under the **System variables** section, locate and select the **Path** variable, then select **Edit**.
49+
1. Under the **System variables** section, locate and select the **Path** variable, and then select **Edit**.
5050

5151
1. Add the directory path of `powershell.exe` to the list of paths.
5252

53-
In most cases, the missing path is: **C:\WINDOWS\System32\WindowsPowerShell\v1.0\\**
53+
In most cases, the missing path is **C:\WINDOWS\System32\WindowsPowerShell\v1.0\\**.
5454

55-
To confirm the correct path, open a PowerShell terminal and run the following command:
56-
57-
`$PsHome`
55+
To confirm the correct path, open a PowerShell terminal and run the `$PsHome` command
5856

5957
Use the displayed path as the value to add to the **Path** variable.
6058

0 commit comments

Comments
 (0)