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 / Passing information ou...
Power Automate
Answered

Passing information out of PowerShell script via PowerShellOutput variable

(0) ShareShare
ReportReport
Posted on by

I am just beginning to use PowerShell in Power Automate Desktop.  I have a fairly complex script that needs to run (creating a Microsoft Team) and I will need to pass various results back after the script finishes.  Since I'm just starting, my script is only attempting to pass a variable straight through.

 

%TeamName% is an input variable that I set to "Test Team", then I call the PowerShell script, which is just this:


$TeamName = "%TeamName%"
write-output $TeamName

 

Ukiman1014_0-1691005470940.png

Ukiman1014_1-1691005509962.png

 

It looks like the issue is that I'm using the "Read text from file" action to read in the .ps1 script file into a variable, which is then executed by the script.

Ukiman1014_0-1691006601795.png

Is there a way to do this while still reading the script from a file?  It is so much more convenient than having to edit the script in the little window.  Right now, the script is just two lines, but the script I will need to run is much longer, so being able to use a script editor, just clicking "save", instead of clearing out the window and cutting and pasting the code is definitely desirable.

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    If you want to read the script from a file, your script will be stored as a literal text. You would then need to use Replace text to replace the placeholders in the script with actual variable values. I would suggest using some other notation in the script file and avoiding the percentage marks, as those will make it harder to replace it afterwards (you would need to escape the % by doing %% instead). 

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

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
11manish Profile Picture

11manish 237 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 227 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 194

Last 30 days Overall leaderboard