Execute VB Script in Desktop flow using Microsoft Power Automate

Microsoft Power Automate is a software by Microsoft for the 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 of 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. VB Script actions Execute some custom VBScript code and retrieve its output into a variable. VBScript doesn't require any special notation to declare new variables. Use the WScript.Echo function to return values from Run VBScript actions to Power Automate.

Reading this article, you can learn how to Execute the VBScript scripts using Run VBScript actions with the Desktop flow in Microsoft Power Automate.

The following important tools are required for developing Microsoft Power Automate,

  1. Windows 10/11 (Recommended)
  2. 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 PADVBScript, Click the Create button,

Execute VB Script

After that, we are able to see the Desktop flow,                                                                                

Execute VB Script

Step 2. For Testing, Run VBScript action in Scripting actions,

Add the Run VBScript action, and Set the VBScript to run parameter as

variableName = "Welcome To C# Corner"

WScript.Echo variableName

and the following variables are produced automatically, For the script's output VBScriptOutput variable and enable the ScriptError variable for errors that may occur during the execution of the VB script code.

Execute VB Script

For Displaying the VB Script Output, Add the Display message action, Set the Message box title Parameter value as  “DispVBSCrptOutput”, and Message to display Parameter value as

  • %VBScriptOutput%
  • %ScriptError%

and Click the Save Button

Execute VB Script

Now, Save the PADVBScript Desktop Flow,

Execute VB Script

Step 3. Now we can run your PADVBScript Desktop Flow in Microsoft Power Automate, 

The output of the PADVBScript,

Execute VB Script


Now, you have successfully tested the Run VBScript action in Desktop flow – PADVBScript in Microsoft Power Automate.

Similar Articles