powershell-workflow

Calling workflow from another workflow as a job in powershell

对着背影说爱祢 提交于 2020-07-19 11:10:34
问题 I have to call a long running workflow from another workflow asynchronously. Is there a way to do that in powershell? workflow CalledWorkflow { Start-Sleep -s 100; } workflow CallingWorkflow { CalledWorkflow "CalledWorkFlow Invoked" } Now when i call CallingWorkflow I need the callingworkflow to immediately return printing "CalledWorkflow Invoked" so that i can start continue my work while the calledworkflow is running in backgroud. 回答1: What environment are you running the workflows in? In

Azure Automation Graphical Runbook - Can't Execute other Runbooks in Automation Account as distinct canvas Activities?

こ雲淡風輕ζ 提交于 2019-12-12 06:42:29
问题 The graphical editor UI appears to allow adding Workflow Runbooks (only; Native PS do not appear), however, this breaks the GraphRunbook definition/execution. When I try to either Test or Publish the runbook, I receive the error in the image. (Also strange, this error message has been rendering in a combination of Spanish for the first part, and English for the second half.) Are other runbooks in the Automation Account technically not supported.. yet? testtwo code: workflow testtwo {

How to execute PowerShell script as Azure Automation Runbook from InlineScript inside PSWorkflow runbook?

为君一笑 提交于 2019-12-12 05:48:19
问题 In a PowerShell Workflow activity, I can call a native PowerShell script using InlineScript: workflow test { InlineScript { .\script.ps1 } } But in Azure Automation, the dot-path (at least in my tests) was returning c:\windows\system32 , and the script-as-runbook in Azure Automation did not exist there (or rather, it failed to execute because it could not find the script). Is it possible to execute a native PS runbook stored in AAuto like this? If so, how do I specify the path to the file? Is

How to define named parameter as [ref] in PowerShell

喜欢而已 提交于 2019-11-30 21:46:55
问题 I'm trying to use [ref] named parameters. However, I am getting an error: workflow Test { Param([Parameter(Mandatory=$true)][String][ref]$someString) write-verbose $someString -Verbose $someString = "this is the new string" } cls $someString = "hi" Test -someString [ref]$someString write-host $someString #Error: Cannot process argument transformation on parameter 'someString'. Reference type is expected in argument. How can I fix this problem? 回答1: I noticed that you are using a "workflow" in

Unable to resume a workflow via task scheduler

不羁岁月 提交于 2019-11-29 14:48:28
In a powershell window I run the following workflow: workflow foo { Suspend-Workflow; "hello world" | Out-File c:\users\weijgerss\desktop\foo.txt } Then to resume the workflow, I have the following scheduled via task scheduler triggered to run at startup: Import-Module PSWorkflow $jobs = Get-Job -state Suspended $jobs > c:\users\weijgerss\desktop\zqqfff.txt $resumedJobs = $jobs | resume-job -wait $resumedJobs | wait-job # Task scheduler action: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Normal -NoLogo -NoProfile -Command "&'c:\users\weijgerss\desktop\resume.ps1'"

Unable to resume a workflow via task scheduler

房东的猫 提交于 2019-11-28 08:33:03
问题 In a powershell window I run the following workflow: workflow foo { Suspend-Workflow; "hello world" | Out-File c:\users\weijgerss\desktop\foo.txt } Then to resume the workflow, I have the following scheduled via task scheduler triggered to run at startup: Import-Module PSWorkflow $jobs = Get-Job -state Suspended $jobs > c:\users\weijgerss\desktop\zqqfff.txt $resumedJobs = $jobs | resume-job -wait $resumedJobs | wait-job # Task scheduler action: C:\Windows\System32\WindowsPowerShell\v1.0

Understanding scope of functions in powershell workflow

空扰寡人 提交于 2019-11-27 17:48:30
问题 Copy and paste the following into a new Powershell ISE script and hit F5: workflow workflow1{ "in workflow1" func1 } function func1 { "in func1" func2 } function func2 { "in func2" } workflow1 the error I get is: The term 'func2' is not recognized as the name of a cmdlet, function, script file, or operable program I don't understand this. Why would func1 be in scope but not func2? Any help much appreciated. TIA. 回答1: Think of Workflows as short-sighted programming elements. A Workflow cannot