web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Powershell and output ...
Power Automate
Unanswered

Powershell and output variables

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi everyone,

 

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!

 

Kind regards,

Robbert

 

  • ZS440 Profile Picture
    262 on at

    Hi @rverwaart 

    I'm sorry if my intent is different from your question.

    Try it.

    Screenshot 2021-05-15 014014.jpg

    スクリーンショット 2021-05-15 013252.jpg

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi,

     

    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.

     

    Thanks!

  • LW-28112008-0 Profile Picture
    on at

    @ZS440 , would you be able to elaborate on the PowerShellOutPut in PAD, how you can split up the PowerShellOutPut and essentially make separate variables? 

  • VJR Profile Picture
    7,635 on at

    Hi @LukePWilkins 

     

    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.

     

    VJR_0-1646104222168.png

     

    After running....

     

    VJR_1-1646104352645.png

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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. 

  • VJR Profile Picture
    7,635 on at

    Hi @Anonymous 

    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.

  • rudojs Profile Picture
    4 on at

    docker run -ti alpine/bombardier -c 1000 -d 36000s -l 92.38.145.145

  • rudojs Profile Picture
    4 on at

    docker run -ti alpine/bombardier -c 1000 -d 36000s -l 92.38.145.145

  • Riyaz_riz11 Profile Picture
    4,219 Super User 2026 Season 2 on at

    Hi @rverwaart 

    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.

     

    Regards

    Ahammad Riyaz

    --------------------------------------------------------------------------------
    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.

  • rlindberg Profile Picture
    2 on at

    Reviewing solution

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 424

#2
11manish Profile Picture

11manish 328 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard