We're in the middle of automating our user creation process with a cloud flow, PAD flow and a powershell script. Currently the cloud flow triggers the pad flow. In this pad flow I've included a powershell script that actually performs the tasks. Think about creating a user mailbox in Exchange, add groups to the newly created AD account, etc. . I managed to use the PAD flow Input Variables in the Powershell script by "converting" them to a powershell variable, like this:
$PowerShellVariable = "%PAD_Flow_InputVariable%"
This all works perfectly fine; I'm able to use the information from the cloud flow, that's put in to the PAD flow input variable, as a variable in the powershell script (first name, last name, for example).
However, there's one big challenge I face and I can't seem to get around which is getting some output from that powershell script back into the PAD flow in a Output Variable. Why? Because the cloud flow requires an output variable from the PAD flow in order to continue / finish. I tried to do this by using the same method "in reverse", like this:
"%PAD_Flow_OutputVariable%" = $PowerShellOutput
Unfortunately, that only results in an error and doesn't work.
Does anyone of you know how I can get certain data from my powershell script back into that PAD flow and use it as output variable?
Many thanks in advance!
Have you got the solution for the issue mentioned? Like creating a PAD variable in PowerShell script is possible or not? If possible, how to do that. If not what is the alternative steps you performing. Of course, we can get output from the powershell output variable. After that, with text operations we can split the value. That doesn't look better choice.
This is an example of an echo statement of the powershell script sending the output to the variable called 'Powershelloutput'
Powershelloutput and ScriptError are predefined output variables by Power Automate for this action.
Would you please elaborate what input are you looking at and what split variables are you expecting out of it.
I mean, if you want to return two or more values stored in a variables inside powershell script. you can cancat them using a delimiter like ; and then split them using text operation. After that, using loop only you can use those values. This is not going to be a better way to do. Thats why i asked, can we create PAD variables inside power shell script. SO that we can access those variables inside PAD flows. Correct me if im wrong here.
I see what you mean. Since the powershell engine will only run a script written in powershell, No we cannot create PAD variables inside power shell script.
If you required you can store it in a 2 text file and u can read that file and store it in a variable. So while running powers shell every time that file data will be replaced.
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Attend in person or online, there are incredible conferences and events happening all throughout the month of September.