2016-01-21 08:51 AM
We have some user interactive scripts written in powershell that I would like to call using a workflow. What I am specifically looking to do is have workflow open the .ps1 file in a powershell window so the user can see the output of the tasks and take any corrective action.
For testing puropses I created a command that runs: start-process powershell.exe expecting that a powershell window will open, however when I execute the workflow it completes but does not open a powershell window.
Thanks for your help
Solved! SEE THE SOLUTION
2016-01-21 10:23 AM
Welcome to the community.
I believe what you are looking for is not an option. When you run the powershell script, it will run within the server, and never pop up this window.
If you can explain a little further on what you are trying to display, we may be able to give you some tips to work around that.
2016-01-21 11:15 AM
Sure, what I am looking to do is create workflows to automate our switch process to our DR site. As part of this process I have powershell scripts that perform various tasks such as shut down services, and power down virtual machines etc... and then perform them in reverse to bring the enviroment back up. In these scripts I have various checks that output the results so I can tell if the tasks were performed sucessfuly with out having to log into the server and check manually.
Initally I was thinking on calling the scripts in the workflow to open them in a powershell window so the output could be displayed and any user interaction, if needed, could be done there.
I am new to WFA, only had it for a few days now, so I am not sure of all of the options that I have. I see this as a great way to give the user (such as myself) a place to run thru all of the steps without having to open individual scripts.
Thanks for your reply
2016-01-21 11:36 AM - edited 2016-01-21 11:37 AM
Here are two options that come to my mind right off the bat.
Option 1: Use 'send-mailmessage' in your command to formulate a email message.
(Downside this assumes your email servers are up, and based on your response this is not a good option.)
Option 2: Use the 'Get-WFALogger' commandlet to display the status of your command. I use this alot in my custom WFA scripts. Reference the code in the 'Create VLAN' command in WFA. There are a ton of other places you can use it. The data you log will be shown during the execution of the workflow. The only thing, is that the user still needs to hit the 'i' on the bottom right of the command. I have attached an example of 2 screenshots. The top one was while the command was running, and the second one was after the command finished. The point of both was to show how you can see the status while the command was running.
Option 2 probably would be better for your situation. I hope this is of help. Let me know if you have any other questions about it.
2016-01-21 11:55 AM
That does help, I will check out the commandlet I think it will do what I am looking for. While I am thinking about it, can I write a log file to a specific location or does WFA already make one that would include the info from Get-WFALogger? At the least I can have the user check the log after the workflow is ran, and give me an audit trail.
2016-01-21 12:08 PM
Yes, you can download the logs directly from the web ui. At the bottom right of the execution window, you will see 'Download Logs' Whatever you log out with that command, will be in that file. That has everything that happened in the workflow including some of the preparation steps. You can also go back and look at the history of the executions made, and download their logs. I'm not sure on the retention of these. These are found on the 'Execution' tab under 'Execution Status'