Execute local command on remote servers until results are met

BatchPatch Forums Home Forums BatchPatch Support Forum Execute local command on remote servers until results are met

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #12216
    greavette
    Participant

    Hello Team,

    I’m looking at using Batchpatch to assist us with executing a check on all remote Windows Servers for the change in value of a Registry Key after restarting a service once. So my usecase would be:

    Step 1: BatchPatch to set registry key to “1” on all remote servers.
    Step 2: BatchPatch to restart the service on all remote servers.
    Step 3: BatchPatch to check registry key from step 1 to confirm it went from “1” to “0”

    Step 3 may take some time and we would like to be able to have Batchpatch poll or continuously check that the key went from “1” to “0”. It may take 5-10 minutes for this change. For servers that this change does not occur we will use Batchpatch to help us identify which ones so we can login and do a healthcheck on why the change didn’t occur.

    My thoughts are to create 3 Batchpatch job’s/processes. Step 1 would execute first and we’ll confirm that all reg key changes occur. Step 2 would then execute to confirm service restart was successful. Then Step 3 would run until change occurs.

    But ideally it would be nice if Batchpatch could do all 3 steps in one pass for us. Or would this be too complicated to execute all at once?

    Please advise how Batchpatch can assist us with this task.

    Thank you,

    #12224
    doug
    Moderator

    Create a remote command in BP to add the desired registry key/value. The command could be a ‘reg add’ command like described here:

    Microsoft’s documentation for Reg Add

    Create a second remote command in BP to stop the desired service, e.g.

    WMIC SERVICE where caption='DNS Client' CALL stopservice

    Create a third remote command in BP to start the desired service, e.g.

    WMIC SERVICE where caption='DNS Client' CALL startservice

    Create a fourth remote command in BP to check the value of the registry entry, e.g.

    REG QUERY "HKLM\Software\Microsoft\.NETFramework" /v InstallRoot

    Then create a BatchPatch Job Queue that executes all of the four commands sequentially, with whatever desired wait periods you want added in between any of the steps that you want to wait.

    https://batchpatch.com/using-the-job-queue-in-batchpatch-for-multi-step-execution

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.