PowerShell工作流学习-3-挂起工作流

关键点:

a)可使用Suspend-Job或Suspend-Workflow(从工作流中)挂起工作流,无法从工作流中恢复工作流。

 

例a:

Workflow Test-Suspend
{
    $a = Get-Date
    Suspend-Workflow
    (Get-Date)- $a
}

PS C:\Windows\system32> Test-Suspend

Id     Name            PSJobTypeName   State         HasMoreData     Location             Command                  
--     ----            -------------   -----         -----------     --------             -------                  
35     Job35           PSWorkflowJob   Suspended     True            localhost            Test-Suspend   


PS C:\Windows\system32> Resume-Job -Name Job35

Id     Name            PSJobTypeName   State         HasMoreData     Location             Command                  
--     ----            -------------   -----         -----------     --------             -------                  
35     Job35           PSWorkflowJob   Running       True            localhost            Test-Suspend 


PS C:\Windows\system32> Get-Job -Name Job35

Id     Name            PSJobTypeName   State         HasMoreData     Location             Command                  
--     ----            -------------   -----         -----------     --------             -------                  
35     Job35           PSWorkflowJob   Completed     True            localhost            Test-Suspend  


PS C:\Windows\system32> Receive-Job -Name Job35 



Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 27
Milliseconds      : 312
Ticks             : 273128905
TotalDays         : 0.000316121417824074
TotalHours        : 0.00758691402777778
TotalMinutes      : 0.455214841666667
TotalSeconds      : 27.3128905
TotalMilliseconds : 27312.8905
PSComputerName    : localhost

 

posted @ 2017-07-05 15:44  万寿宫主  阅读(353)  评论(0编辑  收藏  举报