cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

powershell command to office365 flow

Is it possible to schedule powershell commands in flow to work on office 365 online.

I am wanting to run this command every week

Get-MessageTrace -senderAddress a.user@company.com -StartDate 10/08/2018 -EndDate 10/15/2018 | group-object -Property RecipientAddress | select name,count | sort count -desc

Is it possbile and if so can I feed in variablies to the startdate and enddate so that every week I can collect the results (idealy saved to a sharepoint list) of the last week

output looks like this

Name                                     Count
----                                          -----
some.body@anothercompany.com    10

another@another.com                         6

etc.....

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

 

Hi @kjmcintosh ,

 

You could use Recurrence as a trigger and set Flow to run once a week.

Here is a blog on Run any PnP-PowerAhell in one AzureFunction from Microsoft Flow for your reference:

http://johnliu.net/blog/2018/4/run-any-pnp-powershell-in-one-azurefunction-from-microsoft-flow

Besides, it seems that we could also run on-premises PowerShell script from flow, the following blog for your reference:

https://sergeluca.wordpress.com/2017/12/01/upload-and-run-a-remote-powershell-script-from-microsoft-...

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support
Community Support

 

Hi @kjmcintosh ,

 

You could use Recurrence as a trigger and set Flow to run once a week.

Here is a blog on Run any PnP-PowerAhell in one AzureFunction from Microsoft Flow for your reference:

http://johnliu.net/blog/2018/4/run-any-pnp-powershell-in-one-azurefunction-from-microsoft-flow

Besides, it seems that we could also run on-premises PowerShell script from flow, the following blog for your reference:

https://sergeluca.wordpress.com/2017/12/01/upload-and-run-a-remote-powershell-script-from-microsoft-...

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thanks very much. Although I will really need to look at locking that down so might just run it locally for the time being.

appreciate you help.

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (6,256)