BatchPatch Forums Home › Forums › BatchPatch Support Forum › Execute local command on remote servers until results are met
- This topic has 1 reply, 2 voices, and was last updated 4 years, 9 months ago by doug.
-
AuthorPosts
-
February 14, 2020 at 10:27 am #12216greavetteParticipant
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,
February 14, 2020 at 3:50 pm #12224dougModeratorCreate 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
-
AuthorPosts
- You must be logged in to reply to this topic.