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 / Set variable with one ...
Power Automate
Answered

Set variable with one line of PowershellOutput Variable

(0) ShareShare
ReportReport
Posted on by 3

Hello,

 

Is there a way to set a variable with one particular number line from a Run Powershell script generated variable? Seems like this would be possible, but not sure on the syntax. Thank you.

 

Screenshot 2021-10-13 120752.pngScreenshot 2021-10-13 120858.png

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @miuy7 

     

    You could use action "Split text" to split PowerShell output line by line.

     

    shindomo_1-1634158217268.png

     

    Then you can refer the specific index of list items (line number beggining from 0) using %TextList[1]% format.

     

    shindomo_2-1634158307715.png

     

    Also if you just want to remove unwanted line breaks from the output results, you would like to use %PowershellOutput.Trimmed% to get the actual content from your PowerShell output.

     

    shindomo_0-1634157966811.png

     

    shindomo_3-1634158470187.png

     

    Thank you.

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 275 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 235

#3
David_MA Profile Picture

David_MA 178 Super User 2026 Season 2

Last 30 days Overall leaderboard