{"id":3961,"date":"2018-02-16T17:52:35","date_gmt":"2018-02-16T22:52:35","guid":{"rendered":"http:\/\/batchpatch.com\/?p=3961"},"modified":"2018-02-16T17:52:55","modified_gmt":"2018-02-16T22:52:55","slug":"advanced-multi-row-queue-sequence-contingent-operations-with-custom-scripts","status":"publish","type":"post","link":"https:\/\/batchpatch.com\/advanced-multi-row-queue-sequence-contingent-operations-with-custom-scripts","title":{"rendered":"Advanced Multi-Row Queue Sequence &#8211; Contingent Operations with Custom Scripts"},"content":{"rendered":"<p>Today the goal is to tie together some concepts that I&#8217;ve written about in the past in order to demonstrate how you can use the Advanced Multi-Row Queue Sequence to execute certain actions on some hosts with a contingency that something must be true on another host before the additional hosts begin operations.  <\/p>\n<h2 class=\"brownishOrange\">The Plan<\/a><\/h2>\n<p>Here is the overall picture of what we&#8217;re going to do:<\/p>\n<p><strong>Host1:<\/strong><br \/>\n1. Check if there is enough disk space.  If the available disk space is less than a desired threshold, then stop executing the multi-row queue sequence.  If there is enough disk space available, then go on to the next step.<\/p>\n<p>2. Stop a specific service.  If this action fails, stop executing the multi-row queue sequence.  If it completes, then move on to the next step.<\/p>\n<p>3. Set the service to manual.  If this action fails, stop executing the multi-row queue sequence.  If it completes, then move on to the next step.<\/p>\n<p>4. Install Windows Updates and reboot.<\/p>\n<p>5. Start the stopped service.  If this action fails, stop executing the multi-row queue sequence.  If it completes, then move on to the next step.<\/p>\n<p>6. Set the service back to automatic.  If this action fails, stop executing the multi-row queue sequence.  If it completes, then move on to the next step.<\/p>\n<p>7. Only after all previous actions are complete should the next two hosts begin their operations.<\/p>\n<p><strong>Host2:<\/strong><br \/>\n1. Check if there is enough disk space. If the available disk space is less than a desired threshold, terminate the queue for this host only, but still proceed with the rest of the multi-row queue sequence for Host3.<\/p>\n<p>2. Deploy Firefox<\/p>\n<p><strong>Host3:<\/strong><br \/>\n1. Run a custom script<\/p>\n<p><!--LINE SEPARATOR--><\/p>\n<hr style=\"border-top: 1px solid white; border-bottom: 1px solid gray; width:100%;\"<\/hr>\n<p><!--LINE SEPARATOR--><\/p>\n<h2>Scripts<\/h2>\n<p>In all cases with these scripts we return 0 for success and a non-zero integer (1) for failure.  This enables us to use the job queue special items for &#8216;Terminate queue if previous actions fails\/errors&#8217; and &#8216;Abort advanced multi-row sequence if previous action fails\/errors&#8217;.  If the script returns 1, then those special items will consider it failed and will abort\/terminate.  If the script returns 0, those items will consider it successful and move on to the next step in the queue.<\/p>\n<p><strong>GetCDriveSpace.vbs<\/strong><\/p>\n\n<div class=\"wp_syntax\"><table><tr><td class=\"code\"><pre class=\"vb\" style=\"font-family:monospace;\"><span style=\"color: #008000;\">'Gets the free space on C drive.  If free space is less than specified threshold return 1. Else return 0.  \n<\/span><span style=\"color: #008000;\">'Cocobolo Software LLC April 2017.\n<\/span> \n<span style=\"color: #151B8D; font-weight: bold;\">on<\/span> <span style=\"color: #151B8D; font-weight: bold;\">error<\/span> <span style=\"color: #151B8D; font-weight: bold;\">resume<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">next<\/span>\nErr.Clear\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">Dim<\/span> freeMB\nConst MBCONVERSION = 1048576\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">Set<\/span> objWMIService = <span style=\"color: #E56717; font-weight: bold;\">GetObject<\/span>(<span style=\"color: #800000;\">&quot;winmgmts:\\\\localhost\\root\\cimv2&quot;<\/span>)\n&nbsp;\n<span style=\"color: #008000;\">'Get C drive space\n<\/span><span style=\"color: #151B8D; font-weight: bold;\">Set<\/span> colLogicalDisk = objWMIService.ExecQuery(<span style=\"color: #800000;\">&quot;Select * from Win32_LogicalDisk&quot;<\/span>)\n\t\t<span style=\"color: #8D38C9; font-weight: bold;\">For<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">Each<\/span> objLogicalDisk <span style=\"color: #8D38C9; font-weight: bold;\">in<\/span> colLogicalDisk\n\t\t\t<span style=\"color: #8D38C9; font-weight: bold;\">If<\/span> objLogicalDisk.DeviceId = <span style=\"color: #800000;\">&quot;C:&quot;<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">Then<\/span>\t\t\t\t\t\n\t\t\t\tfreeMB = objLogicalDisk.freespace\/MBCONVERSION\n\t\t\t<span style=\"color: #8D38C9; font-weight: bold;\">End<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">If<\/span>\n\t\t<span style=\"color: #8D38C9; font-weight: bold;\">Next<\/span>\n&nbsp;\n<span style=\"color: #8D38C9; font-weight: bold;\">If<\/span> freeMB &lt; 500 <span style=\"color: #8D38C9; font-weight: bold;\">Then<\/span>\n\twscript.quit(1)\n<span style=\"color: #8D38C9; font-weight: bold;\">Else<\/span>\n\twscript.quit(0)\n<span style=\"color: #8D38C9; font-weight: bold;\">End<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">If<\/span><\/pre><\/td><\/tr><\/table><\/div>\n\n<p>\n<strong>StopService.vbs<\/strong><\/p>\n\n<div class=\"wp_syntax\"><table><tr><td class=\"code\"><pre class=\"vb\" style=\"font-family:monospace;\"><span style=\"color: #008000;\">'Stops the specified service and returns 0 if successful else returns non-0\n<\/span><span style=\"color: #008000;\">'Cocobolo Software LLC February 2018.\n<\/span>\n<span style=\"color: #008000;\">'Usage: cscript.exe &quot;C:\\Your Script Repository\\StopService.vbs&quot; &quot;Your service display name goes here&quot;\n<\/span>\n<span style=\"color: #008000;\">'The first argument from the command line is assigned to strServiceDisplayName\n<\/span>strServiceDisplayName = WScript.Arguments(0)\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">on<\/span> <span style=\"color: #151B8D; font-weight: bold;\">error<\/span> <span style=\"color: #151B8D; font-weight: bold;\">resume<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">next<\/span>\nErr.Clear\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">Set<\/span> objWMIService = <span style=\"color: #E56717; font-weight: bold;\">GetObject<\/span>(<span style=\"color: #800000;\">&quot;winmgmts:\\\\localhost\\root\\cimv2&quot;<\/span>)\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">Set<\/span> colServices = objWMIService.ExecQuery(<span style=\"color: #800000;\">&quot;Select * from Win32_Service where DisplayName='&quot;<\/span> &amp; strServiceDisplayName &amp; <span style=\"color: #800000;\">&quot;'&quot;<\/span>)\n\t<span style=\"color: #8D38C9; font-weight: bold;\">For<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">Each<\/span> objService <span style=\"color: #8D38C9; font-weight: bold;\">in<\/span> colServices\n\t\tReturnValue = objService.StopService()\n\t\t\twscript.quit(ReturnValue)\t\t\t\n\t<span style=\"color: #8D38C9; font-weight: bold;\">Next<\/span><\/pre><\/td><\/tr><\/table><\/div>\n\n<p>\n<strong>StartService.vbs<\/strong><\/p>\n\n<div class=\"wp_syntax\"><table><tr><td class=\"code\"><pre class=\"vb\" style=\"font-family:monospace;\"><span style=\"color: #008000;\">'Starts the specified service and returns 0 if successful else returns non-0\n<\/span><span style=\"color: #008000;\">'Cocobolo Software LLC February 2018.\n<\/span>\n<span style=\"color: #008000;\">'Usage: cscript.exe &quot;C:\\Your Script Repository\\StartService.vbs&quot; &quot;Your service display name goes here&quot;\n<\/span>\n<span style=\"color: #008000;\">'The first argument from the command line is assigned to strServiceDisplayName\n<\/span>strServiceDisplayName = WScript.Arguments(0)\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">on<\/span> <span style=\"color: #151B8D; font-weight: bold;\">error<\/span> <span style=\"color: #151B8D; font-weight: bold;\">resume<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">next<\/span>\nErr.Clear\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">Set<\/span> objWMIService = <span style=\"color: #E56717; font-weight: bold;\">GetObject<\/span>(<span style=\"color: #800000;\">&quot;winmgmts:\\\\localhost\\root\\cimv2&quot;<\/span>)\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">Set<\/span> colServices = objWMIService.ExecQuery(<span style=\"color: #800000;\">&quot;Select * from Win32_Service where DisplayName='&quot;<\/span> &amp; strServiceDisplayName &amp; <span style=\"color: #800000;\">&quot;'&quot;<\/span>)\n\t<span style=\"color: #8D38C9; font-weight: bold;\">For<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">Each<\/span> objService <span style=\"color: #8D38C9; font-weight: bold;\">in<\/span> colServices\n\t\tReturnValue = objService.StartService()\n\t\t\twscript.quit(ReturnValue)\t\t\t\n\t<span style=\"color: #8D38C9; font-weight: bold;\">Next<\/span><\/pre><\/td><\/tr><\/table><\/div>\n\n<p>\n<strong>SetServiceToManual.vbs<\/strong><\/p>\n\n<div class=\"wp_syntax\"><table><tr><td class=\"code\"><pre class=\"vb\" style=\"font-family:monospace;\"><span style=\"color: #008000;\">'Sets the specified service to manual and returns 0 if successful else returns non-0\n<\/span><span style=\"color: #008000;\">'Cocobolo Software LLC February 2018.\n<\/span>\n<span style=\"color: #008000;\">'Usage: cscript.exe &quot;C:\\Your Script Repository\\SetServiceToManual.vbs&quot; &quot;Your service display name goes here&quot;\n<\/span>\n<span style=\"color: #008000;\">'The first argument from the command line is assigned to strServiceDisplayName\n<\/span>strServiceDisplayName = WScript.Arguments(0)\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">on<\/span> <span style=\"color: #151B8D; font-weight: bold;\">error<\/span> <span style=\"color: #151B8D; font-weight: bold;\">resume<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">next<\/span>\nErr.Clear\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">Set<\/span> objWMIService = <span style=\"color: #E56717; font-weight: bold;\">GetObject<\/span>(<span style=\"color: #800000;\">&quot;winmgmts:\\\\localhost\\root\\cimv2&quot;<\/span>)\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">Set<\/span> colServices = objWMIService.ExecQuery(<span style=\"color: #800000;\">&quot;Select * from Win32_Service where DisplayName='&quot;<\/span> &amp; strServiceDisplayName &amp; <span style=\"color: #800000;\">&quot;'&quot;<\/span>)\n\t<span style=\"color: #8D38C9; font-weight: bold;\">For<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">Each<\/span> objService <span style=\"color: #8D38C9; font-weight: bold;\">in<\/span> colServices\n\t\tReturnValue = objService.ChangeStartMode(<span style=\"color: #800000;\">&quot;manual&quot;<\/span>)\n\t\t\twscript.quit(ReturnValue)\t\t\t\n\t<span style=\"color: #8D38C9; font-weight: bold;\">Next<\/span><\/pre><\/td><\/tr><\/table><\/div>\n\n<p>\n<strong>SetServiceToAutomatic.vbs<\/strong><\/p>\n\n<div class=\"wp_syntax\"><table><tr><td class=\"code\"><pre class=\"vb\" style=\"font-family:monospace;\"><span style=\"color: #008000;\">'Sets the specified service to automatic and returns 0 if successful else returns non-0\n<\/span><span style=\"color: #008000;\">'Cocobolo Software LLC February 2018.\n<\/span>\n<span style=\"color: #008000;\">'Usage: cscript.exe &quot;C:\\Your Script Repository\\SetServiceToAutomatic.vbs&quot; &quot;Your service display name goes here&quot;\n<\/span>\n<span style=\"color: #008000;\">'The first argument from the command line is assigned to strServiceDisplayName\n<\/span>strServiceDisplayName = WScript.Arguments(0)\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">on<\/span> <span style=\"color: #151B8D; font-weight: bold;\">error<\/span> <span style=\"color: #151B8D; font-weight: bold;\">resume<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">next<\/span>\nErr.Clear\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">Set<\/span> objWMIService = <span style=\"color: #E56717; font-weight: bold;\">GetObject<\/span>(<span style=\"color: #800000;\">&quot;winmgmts:\\\\localhost\\root\\cimv2&quot;<\/span>)\n&nbsp;\n<span style=\"color: #151B8D; font-weight: bold;\">Set<\/span> colServices = objWMIService.ExecQuery(<span style=\"color: #800000;\">&quot;Select * from Win32_Service where DisplayName='&quot;<\/span> &amp; strServiceDisplayName &amp; <span style=\"color: #800000;\">&quot;'&quot;<\/span>)\n\t<span style=\"color: #8D38C9; font-weight: bold;\">For<\/span> <span style=\"color: #8D38C9; font-weight: bold;\">Each<\/span> objService <span style=\"color: #8D38C9; font-weight: bold;\">in<\/span> colServices\n\t\tReturnValue = objService.ChangeStartMode(<span style=\"color: #800000;\">&quot;automatic&quot;<\/span>)\n\t\t\twscript.quit(ReturnValue)\t\t\t\n\t<span style=\"color: #8D38C9; font-weight: bold;\">Next<\/span><\/pre><\/td><\/tr><\/table><\/div>\n\n<p><\/p>\n<h2 class=\"brownishOrange\">Create Custom Script Deployments<\/h2>\n<p>For each script file we need to create a deployment in BatchPatch.  I have all of my scripts in a single folder on my BatchPatch computer.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-16_48_22-ScriptRepository.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-16_48_22-ScriptRepository.png\" alt=\"\" width=\"536\" height=\"186\" class=\"aligncenter size-full wp-image-3964\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_48_22-ScriptRepository.png 536w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_48_22-ScriptRepository-300x104.png 300w\" sizes=\"auto, (max-width: 536px) 100vw, 536px\" \/><\/a><\/p>\n<p>Select <em>&#8216;Actions > Deploy > Create\/modify&#8217;<\/em>, and then for each script create a deployment that looks like the following screenshots, and save those deployments using the double-right-arrow button.  Note, the DiskCheck.vbs deployment has no parameters, but each of the other deployments has the desired service name as its only parameter:<\/p>\n<p><a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-16_56_38-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-16_56_38-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png\" alt=\"\" width=\"858\" height=\"471\" class=\"aligncenter size-full wp-image-3966\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_56_38-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png 858w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_56_38-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc-300x165.png 300w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_56_38-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc-768x422.png 768w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-16_56_59-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-16_56_59-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png\" alt=\"\" width=\"858\" height=\"471\" class=\"aligncenter size-full wp-image-3967\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_56_59-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png 858w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_56_59-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc-300x165.png 300w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_56_59-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc-768x422.png 768w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_06-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_06-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png\" alt=\"\" width=\"858\" height=\"471\" class=\"aligncenter size-full wp-image-3968\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_06-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png 858w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_06-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc-300x165.png 300w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_06-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc-768x422.png 768w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_41-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_41-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png\" alt=\"\" width=\"858\" height=\"471\" class=\"aligncenter size-full wp-image-3970\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_41-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png 858w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_41-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc-300x165.png 300w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_41-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc-768x422.png 768w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_17-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_17-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png\" alt=\"\" width=\"858\" height=\"471\" class=\"aligncenter size-full wp-image-3969\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_17-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc.png 858w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_17-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc-300x165.png 300w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-16_57_17-Deploy-.msi-.msp-.msu-.exe-.reg-.vbs-.bat-.cmd-.ps1-etc-768x422.png 768w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><\/a><\/p>\n<h2 class=\"brownishOrange\">Create Job Queue For Each Host<\/h2>\n<p>Before we create the Advanced Multi-Row Queue Sequence we have to create a job queue for each host.  The job queue will be the step by step list of operations that we want each host to execute inside of the advanced multi-row queue sequence.  <\/p>\n<p>Select <em>&#8216;Actions > Job Queue > Create \/ modify&#8217;<\/em> and then create the following job queues for each host.  You can &#8216;apply queue&#8217; to each host\/row accordingly:<\/p>\n<p><strong>Host1<\/strong><br \/>\n<a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_28_11-Job-Queue.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_28_11-Job-Queue-1024x651.png\" alt=\"\" width=\"540\" height=\"343\" class=\"aligncenter size-large wp-image-3973\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_28_11-Job-Queue-1024x651.png 1024w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_28_11-Job-Queue-300x191.png 300w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_28_11-Job-Queue-768x488.png 768w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_28_11-Job-Queue.png 1046w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/a><\/p>\n<p><strong>Host2<\/strong><br \/>\n<a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_31_39-Job-Queue.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_31_39-Job-Queue-1024x651.png\" alt=\"\" width=\"540\" height=\"343\" class=\"aligncenter size-large wp-image-3974\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_31_39-Job-Queue-1024x651.png 1024w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_31_39-Job-Queue-300x191.png 300w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_31_39-Job-Queue-768x488.png 768w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_31_39-Job-Queue.png 1046w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/a><\/p>\n<p><strong>Host3<\/strong><br \/>\n<a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_34_42-Job-Queue.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_34_42-Job-Queue-1024x651.png\" alt=\"\" width=\"540\" height=\"343\" class=\"aligncenter size-large wp-image-3975\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_34_42-Job-Queue-1024x651.png 1024w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_34_42-Job-Queue-300x191.png 300w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_34_42-Job-Queue-768x488.png 768w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_34_42-Job-Queue.png 1046w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/a><\/p>\n<p>Note, for the places where we want to abort the entire multi-row queue sequence if the previous action fails\/errors, we always add that special item right before the &#8216;terminate queue if previous action fails\/errors&#8217; because if we terminated the queue first, then the queu would not be running and could therefore not execute the command to abort the entire multi row queue sequence.  However, in the case of Host2, we want to *only* terminate the queue if the previous action fails\/errors, but we do not want to abort the entire multi-row queue sequence.<\/p>\n<h2 class=\"brownishOrange\">Assembling the Advanced Multi-Row Queue Sequence<\/h2>\n<p>Finally we will create our sequence.  I&#8217;ve gone ahead and added a new row to the grid called &#8216;SequenceExecutionRow&#8217; which is essentially a dummy row that is used just for the multi-row queue sequence.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_40_43-new-1-BatchPatch-X4.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_40_43-new-1-BatchPatch-X4.png\" alt=\"\" width=\"647\" height=\"408\" class=\"aligncenter size-full wp-image-3976\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_40_43-new-1-BatchPatch-X4.png 647w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_40_43-new-1-BatchPatch-X4-300x189.png 300w\" sizes=\"auto, (max-width: 647px) 100vw, 647px\" \/><\/a><\/p>\n<ol>\n<li>\nWith that special row selected, choose <em>&#8216;Actions > Job Queue > Create \/ modify advanced multi-row queue sequence&#8217;<\/em><\/li>\n<li>In the window that appears enter a Sequence Name and select the radio button for &#8216;Create Sequence Execution Row&#8217;, and apply it to the SequenceExecutionRow<br \/>\n<a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_43_10-.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_43_10-.png\" alt=\"\" width=\"649\" height=\"410\" class=\"aligncenter size-full wp-image-3977\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_43_10-.png 649w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_43_10--300x190.png 300w\" sizes=\"auto, (max-width: 649px) 100vw, 649px\" \/><\/a>\n<\/li>\n<li>Next highlight Host1 and choose the radio button &#8216;Set Sequence Position Number&#8217; with a value of 1.<br \/>\n<a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_44_34-.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_44_34-.png\" alt=\"\" width=\"649\" height=\"410\" class=\"aligncenter size-full wp-image-3978\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_44_34-.png 649w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_44_34--300x190.png 300w\" sizes=\"auto, (max-width: 649px) 100vw, 649px\" \/><\/a>\n<\/li>\n<li>Do the same with Host2 and Host3.<br \/>\n<a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_46_00-new-1-BatchPatch-X4.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_46_00-new-1-BatchPatch-X4.png\" alt=\"\" width=\"647\" height=\"408\" class=\"aligncenter size-full wp-image-3979\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_46_00-new-1-BatchPatch-X4.png 647w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_46_00-new-1-BatchPatch-X4-300x189.png 300w\" sizes=\"auto, (max-width: 647px) 100vw, 647px\" \/><\/a>\n<\/li>\n<li>Finally we are ready to execute the sequence.  Highlight the SequenceExecutionRow and select &#8216;Actions > Job Queue > Execute advanced multi-row queue sequence.<br \/>\n<a href=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_47_20-.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2018\/02\/2018-02-16-17_47_20-.png\" alt=\"\" width=\"778\" height=\"751\" class=\"aligncenter size-full wp-image-3980\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_47_20-.png 778w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_47_20--300x290.png 300w, https:\/\/batchpatch.com\/wp-content\/uploads\/2018\/02\/2018-02-16-17_47_20--768x741.png 768w\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><\/a>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Today the goal is to tie together some concepts that I&#8217;ve written about in the past in order to demonstrate how you can use the Advanced Multi-Row Queue Sequence to execute certain actions on some hosts with a contingency that something must be true on another host before the additional hosts begin operations. The Plan [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1,17,3],"tags":[293,238,294,129,99,100],"class_list":["post-3961","post","type-post","status-publish","format-standard","hentry","category-blog","category-general","category-tutorials","tag-advanced-multi-row-queue-sequence","tag-advanced-scripting","tag-contingent-operations","tag-custom-scripting","tag-job-queue","tag-multi-step-execution"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/posts\/3961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/comments?post=3961"}],"version-history":[{"count":6,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/posts\/3961\/revisions"}],"predecessor-version":[{"id":3982,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/posts\/3961\/revisions\/3982"}],"wp:attachment":[{"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/media?parent=3961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/categories?post=3961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/tags?post=3961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}