BatchPatch Forums Home › Forums › BatchPatch Support Forum › Executing script against a list of computers
- This topic has 2 replies, 2 voices, and was last updated 7 years, 8 months ago by doug.
-
AuthorPosts
-
April 7, 2017 at 12:13 pm #9068greavetteParticipant
Hello Forum,
I’ve been using batchpatch for a little while now so I’m aware that psexec is instrumental to running instructions on the machines I’ve loaded into batchpatch. My question is a little different in that I want batchpatch to run a script against each machine I’ve loaded into batchpatch and this script will not be executed from within the list of machines.
I’m assuming I’ll need to ensure my script reads in the hostname/computername from the batchpatch window as a variable. Can batchpatch be used in this way?
Thank you.
April 7, 2017 at 2:49 pm #10728dougModeratorYou said “I want batchpatch to run a script against each machine I’ve loaded into batchpatch and this script will not be executed from within the list of machines.”
I don’t understand what you mean when you say “this script will not be executed from within the list of machines.”
There are two ways that BatchPatch can be used to execute a script against a target computer.
1. BatchPatch can be used to deploy a script to a target computer and have that script run on the target computer. For this you would follow the normal deployment process, but the item that you are deploying is a script, not an installation package. There are numerous examples at Software Deployment. There is also a script being deployed as part of this tutorial: Install Windows Updates Only If Sufficient Space Is Detected On Target C Drive
2. BatchPatch can be used to execute a local script on the BatchPatch computer, but you can feed the target computer name into the script, so that the script can operate against the target computer without actually running directly on the target computer. In this case you use a Local command in BatchPatch with the $computer variable used to send the host name into the script as a parameter. An example of this is illustrated inside the following tutorial: Advanced Script Integration with BatchPatch
April 7, 2017 at 7:30 pm #10698greavetteParticipantHi Doug,
Thanks very much for this detailed explanation. Your explanation #2 on how to use batchpatch to execute a local script on the batchpatch computer is best describes what I want to do.
In my use case I’m looking to leverage the usefulness of batchpatch to execute Powershell ssh (or plink.exe) commands to run against a list of Linux computers for patching purposes. I know that batchpatch does not have ssh installed but perhaps through scripting I’ll be able to accomplish what I need.
Thanks very much for the response and the example links.
-
AuthorPosts
- You must be logged in to reply to this topic.