So I have a series of PowerShell workflows that do controlled patching using SCCM.
If I start the patching workflow using a scheduled task when it suspends at a checkpoint I'm looking at being able to resume it again but the job is not viewable to resume.
Having read http://blogs.msdn.com/b/powershell/archive/2013/12/23/automatically-resuming-windows-powershell-workflow-jobs-at-logon.aspx and trying to meet requirements there.
Below is an example of sequential patching workflow where server 1 is patched, then suspended and an email is sent to say resume the workflow to patch the second server (it's just an example of suspending and resuming workflow).
I've made the scheduled job interactive and run with highest privileges, opening the console as admin and same username as the task is run.
PS C:\Windows\system32> get-job
Id Name PSJobTypeName State HasMoreData Location
Command
-- ---- ------------- ----- ----------- --------
-------
11 PatchSequent... PSScheduledJob Completed True localhost Import-module
iiSCOMTo...
PS C:\Windows\system32> get-job | receive-job
8/09/2015 11:14:39 AM isp-dev-patch1: Did not snapshot as requested
8/09/2015 11:14:39 AM isp-dev-patch1: Starting maint mode
8/09/2015 11:15:06 AM isp-dev-patch1 Putting into Maint mode has succeeded
8/09/2015 11:15:06 AM isp-dev-patch1: Starting Patching
8/09/2015 11:15:07 AM isp-dev-patch1: Scanning and installing patches
8/09/2015 11:17:09 AM isp-dev-patch1: Monitoring patching
8/09/2015 11:18:11 AM isp-dev-patch1: Finished patching
8/09/2015 11:18:41 AM isp-dev-patch1: Patching is complete.
Id Name PSJobTypeName State HasMoreData Location
Command
-- ---- ------------- ----- ----------- --------
-------
1 Job1 PSWorkflowJob Suspended True localhost
Invoke-iiPatchSequenti...
PS C:\Windows\system32> ipmo PSWorkflow
PS C:\Windows\system32> get-job
Id Name PSJobTypeName State HasMoreData Location
Command
-- ---- ------------- ----- ----------- --------
-------
11 PatchSequent... PSScheduledJob Completed False localhost Import-module iiSCOMTo...
PS C:\Windows\system32>
I cannot actually find the suspended workflow from a console, same username, same server, elevated or not elevated.
Starting the same task from console, works fine as I guess it satisfies all the requirements to find the suspended workflow.
So question is how do people reliably find and resume a suspended workflow that is started from a scheduled task? The future would be to build an SMA and WAP environment.