How to login to Powershell console from Workflow Job
I have a Powershell workflow. I need to write data to the Console so that I can clearly see the progress of the workflow. So far I have used Log-Verbose
to achieve this. When I execute this workflow using the switch -Verbose
, the polite logs are displayed on the console as expected.
workflow Test-Workflow
{
Log-Verbose "Inside Test-Workflow"
}
Test-Workflow -Verbose
Now I need to use breakpoints inside the workflow. To use breakpoints, I need to start the workflow as Job
.
Test-Workflow -Verbose -AsJob
When I do this, I no longer see the verbose logs in the console. I know I can write to a file or write logs as events, but I would really like to write them to the console. Let me know if this is possible and how.
source to share
I'm sure you've already found a solution for this, but you can use:
Write-Output "I will print to the console"
According to MSDN: Write-Output :
Sends the specified objects to the next command in the pipeline. If the command is the last command in the pipeline, the objects are displayed in the console.
source to share