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 / How to pass parameters...
Power Automate
Unanswered

How to pass parameters from local to power automate

(0) ShareShare
ReportReport
Posted on by 2

Dear Madam/Sir,

 

I created a GPO to place a file on all users' desktop, I want to collect the result and find out who is failed to apply the GPO (By detect the files exists).

I use "When a HTTP request is received" as trigger, then  created a Powershell file use invoke-webrequest to trigger the flow and send parameter - username,hostname,date,time,and file exists.

Please see the code in PS1 file


$fileexists=test-Path -Path "C:\Users\$env:username\OneDrive - INABATA CO., LTD\デスクトップ\Shorcut_creation.ps1" -PathType Leaf

$postParams = @{username=hostname;hostname=whoami;thedate=Get-Date -Format "MM/dd/yyyy";thetime=Get-Date -Format "hh:mm";fileexists=$fileexists}
invoke-webrequest -uri "XXXXXXXXXXXXXXXXXX" -Method POST -Body $postParams

 

when I run the PS1 file, my flow will receive below JSON in body of the trigger,

 

{
  "$content-type""application/x-www-form-urlencoded",
  "$content""dXNlcm5hbWU9Q1pDMTA2MCZmaWxlZXhpc3RzPUZhbHNlJnRoZWRhdGU9MDYlMkYyOCUyRjIwMjImaG9zdG5hbWU9Y2hpbmElNUN6aGFuZy5yZW4mdGhldGltZT0wNCUzQTQ0",
  "$formdata": [
    {
      "key""username",
      "value""CZC1060"
    },
    {
      "key""fileexists",
      "value""False"
    },
    {
      "key""thedate",
      "value""06/28/2022"
    },
    {
      "key""hostname",
      "value""china\\zhang.ren"
    },
    {
      "key""thetime",
      "value""04:44"
    }
  ]
}

 

I want to parse it and extract the value, in this case they are "CZC1060","False","06/28/2022","china\\zhang.ren","04:44",
I use "parse JSON" as a action ,and use above JSON as sample to generate schema, but it cannot successfully parse the key/value pair.

Would you please advise

Categories:
I have the same question (0)
  • JohnAageAnderse Profile Picture
    1,986 on at

    Hello @Ryan_Zhang_1982 

    I checked the Invoke-WebRequest parameters and found this example in the documentation.

    In short, it looks like you should use the Form parameter instead of the Body parameter!

    Kind regards, John

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 976

#2
Valantis Profile Picture

Valantis 863

#3
Haque Profile Picture

Haque 547

Last 30 days Overall leaderboard