Take and remove vmware snapshots using batchpatch

BatchPatch Forums Home Forums BatchPatch Support Forum Take and remove vmware snapshots using batchpatch

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8675
    mikeleahy1234
    Participant

    Hi All

    I have a script that i use to take snapshots of windows virtual machines running on esxi. The script has a menu in it which asks for the vCenter name and my resource pool name etc

    Is it possible to call the script using batchpatch and send the inputs for the file via batchpatch ?

    #9795
    doug
    Moderator

    Hi Mike – Yes you can do that. You would just need to parameterize the inputs so that you can pass them into the script at the time you run the script rather than having the script prompt you with a dialog. Below are a few different tutorials that should give you an idea of how you can do it.

    virtual-machine-create-snapshot-apply-windows-updates-reboot-remove-snapshot-basic-multi-row-queue-sequence-example

    advanced-script-integration-with-batchpatch

    advanced-script-integration-with-batchpatch-part-2

    #9800
    mikeleahy1234
    Participant

    thanks for that Doug. Could you give me a very simple example ? I dont follow how to pass the answers into the script when it runs.

    The script would be run locally on the batchpatch server so it would be run locally

    The script is a ps1 file

    #9801
    doug
    Moderator

    Step 1: Parameterize your powershell script so that it can accept arguments. Multiple examples of how to do that are explained here: https://stackoverflow.com/questions/5592531/how-to-pass-an-argument-to-a-powershell-script

    Step 2: Run a local command in BatchPatch to execute the script.

    ‘Actions > Execute local process/command > Create/modify’ :

    powershell.exe c:scriptspowershellscript.ps1 vCenterName, ResourcePoolName

    or if you want to pass the host name from the BatchPatch ‘Host’ column you can use $computer :

    powershell.exe c:scriptspowershellscript.ps1 $computer, vCenterName, ResourcePoolName

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