I am trying to get a flow to work that uses CMD session. My flow looks like this:
All is working as expected when I start my flow from the edit window. However, when I execute the exact same flow from the main (or overview) window (first window you see when PAD is started) it doesn't work, even after the computer has been restarted.
I tried the following:
More infos that might be helpful:
Is there an error message or what exactly doesn't work?
I tried executing curl from within the documents folder, works fine.
Try updating to the latest version first: https://go.microsoft.com/fwlink/?linkid=2102613
There is no error message, the command just don't get executed properly.
I did some more testing and was able to narrow down the problem more. The specific CMD command ipconfig seems to play a role here.
Whenever I let PAD write the command ipconfig to CMD session, CmdOutput holds different outputs depending on which window the Flow has been started from.
When starting the flow from edit window, the result is as expected, CmdOutput holds the usual expected information about Windows IP configuration, ethernet adapters, IPs, subnet masks etc. etc.
When starting the flow from main window CmdOutput holds only this information:
Microsoft Windows [Version 10.0.18363.1440]
(c) 2019 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Program Files (x86)\Power Automate Desktop>ipconfig
I tested another CMD command: dir generates the same expected output no matter which PAD-window I start the flow from.
What am I missing? Any idea what causes this problem? Can I add something to my flow to prevent this from happening?
Strange, even with ipconfig it works fine for me. Could you paste your flow code here?
Did you try a different working folder, like your user folder?
Any reason you didn't yet update to Windows 10 version 2004?
Any security software which might prevent app execution?
Thank you for investing time and trying it on your machine, sharing the results with me. It seems that my company's laptop or IT infrastructure has something to do with it then. Maybe its a security thing.
Here's the code of the Flow I tested this issue with, just in case:
Folder.GetSpecialFolder SpecialFolder: Folder.SpecialFolder.Personal SpecialFolderPath=> SpecialFolderPath
Cmd.Open Directory: SpecialFolderPath Session=> CmdSession
Cmd.Write Session: CmdSession Command: $'''ipconfig''' SendEnter: True
Cmd.Read Session: CmdSession CmdOutput=> CmdOutput
Cmd.Close Session: CmdSession
File.WriteText File: $'''C:\\Users\\olafp\\Desktop\\CmdCheck.txt''' TextToWrite: CmdOutput AppendNewLine: True IfFileExists: File.IfFileExists.Overwrite Encoding: File.FileEncoding.Unicode
System.RunApplication ApplicationPath: $'''C:\\Users\\olafp\\Desktop\\CmdCheck.txt''' WindowStyle: System.ProcessWindowStyle.Normal ProcessId=> AppProcessId
I also tried different folders for CMD session, including the default one.
Yes, I did, I'm on version 2.6.00158.21069 now. Still doesn't work. At least I know that it wasn't something in my code and that it is working on other machines. I guess from now on I will run my flows only from edit window to be on the safe side.