The easiest way to allow many many many scenarios imho would be to do this as follows:
This would enable a gazillion scenarios where you might want to create a local file, print, or run any type of script by clicking a button in the power app that today people are trying to find workarounds for via Flow and on premise gateways etc...
I have seen examples of Launch to open a web page, to dial a phone number, to send an email, etc... so a lot of the plumbing is already there.
Currently there is no connector for PowerShell available to be used in either Flow or PowerApps. as such, there is no direct way to tap into this directly.
with this in mind there are only 2 possibilites that come into my mind that could be used as a workaround for this issue.
This option would require you to create a custom connector that would tap directly into PowerShell API, although I'm not exactly sure how this could be accomplished.
Information on creating custom connectors is available here.
2. Use a UI Flow for Desktop.
In this option you would need to create a UI Flow for desktop. This would tap into some of your points provided such as:
You can use UI flows to automate repetitive tasks in Windows and Web applications. UI flows records and plays back user interface actions (clicks, keyboard input, etc.) for applications that don't have easy-to-use or complete APIs available.
To achieve these points and return back the results, you would need to incorporate the UI Flows action into a Flow which could be acceded through PowerApps.
Hope this helps!
The problem with these workarounds is that it is my understanding that they run in the infrastructure of the flow platform. What I need is to run this on the machine that launched the power app. How would this work with a UI flow ? Which UI does this control ? Does it control actions that normally the user would take himself on his local machine ? Under which user does this run ?
When you create a UI Flow, one of the prerequisites you have is to first set up a on-premises gateway for the device where the UI Flow will be triggered. This is due to the fact that the UI flow will need to have access to the local machine to execute the actions that you want to automate for the user.
When you create this UI Flow you will need to use the same account for setting up the gateway, and to use as credential in the UI Flow connection, When doing this you are assuring that the UI flow is being executed as the user you have set up here.
You have some additional documentation here for executing unattended and attended UI Flows, that might help clear some of these questions: https://docs.microsoft.com/en-us/power-automate/ui-flows/run-ui-flow.
Let me know if this helps!
I tried to record a UI Flow to perform the following action
"C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE" "c:\temp\Ticket-18.xml" /mFilePrintDefault /mFileExit /q /n
Basically, what I want is to open a file in word, print it out and close word
When testing it always fails, because the recorder just starts word and then sits there waiting. It doesn't open the file, but stays stuck on the Word Home page:
The action in Flow generated by the recorder is just to start Word. If I try to add command line parameters it even fails to start Word at all
When you recorded the steps or your UI flow did you verify if the steps all appeared in the actions? When you say print out your intent is to print the file?
When you execute the Flow make sure that you are running it as attended, otherwise you will need to be logged out of the machine where the flow will execute in order for it to function.
Additionally, you can also try and contact Microsoft Support through https://admin.powerplatform.microsoft.com/support in order to troubleshoot this in more depth.
Save-Module -Name Microsoft.PowerApps.Administration.PowerShell -Path
Import-Module -Name Microsoft.PowerApps.Administration.PowerShell
Save-Module -Name Microsoft.PowerApps.PowerShell -Path
Import-Module -Name Microsoft.PowerApps.PowerShell
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!