Microsoft Power Automate, is a software by Microsoft for automation of recurring tasks. It is part of the Microsoft Power Platform line of products together with products such as Power Apps and Power BI. More Details https://powerautomate.microsoft.com/en-us/
Desktop flows are the existing robotic process automation (RPA) capabilities in Power Automate and enable to automate all repetitive desktop processes.
Scripting actions enable you to run blocks of code and implement custom behavior in your desktop flows. All scripting actions follow the basic structure of the respective programming or scripting language: PowerShell, Python, DOS Command, VBScript, and JavaScript.
Execute the PowerShell scripts to declare new variables use the $ notation and return the values from Run PowerShell script action, which use the Write-Output function.
Reading this article, you can learn how to Execute the PowerShell scripts using Run PowerShell script actions with Desktop flow in Microsoft Power Automate.
The following important tools are required for developing Microsoft Power Automate,
- Windows 10/11 (Recommended)
- Power Automate Desktop - Download the Power Automate installer
Now we can discuss step by step App development.
Step 1
Open Microsoft Power Automate -> New Flow
Next, give the Flow name as PADPowershell, click the Create button,
After that, we are able to see the Desktop flow,
Step 2
For Testing Run PowerShell script action in Scripting actions,
Add the Run PowerShell script action, and Set the PowerShell script to run parameter as
$text=" Welcome to C# Corner!............"
Write-Output $text
Click Save Button, also the following variables produced automatically, For script's output PowershellOutput variable and enable the ScriptError variable for errors that may occur during the execution of the Poweshell script code.
For Displaying the Powershell Script Output, Add the Display message action, Set the Message box title Parameter value as “Powershell Output”, Message to display Parameter value as
% PowershellOutput%
%ScriptError%
and Click Save Button
Now, Save the PADPowershell Desktop Flow,
Step 3
Now we can run your PADPowershell Desktop Flow in Microsoft Power Automate,
The output of the PADPowershell,
Summary
Now, you are successfully tested Powershell Script action in Desktop flow – PADPowershell in Microsoft Power Automate.