BatchPatch If Then Statements

BatchPatch Forums Home Forums BatchPatch Support Forum BatchPatch If Then Statements

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8970
    jkeplinger
    Participant

    I am trying to see if there are any multistep sequencing to create a process where a list of hosts will check the OS and then based on the result push the appropriate EXE to the devices silently. I have the EXE working fine but find it tedious to do the check OS step first. I know I can control this process using PowerShell but just working out logistics of self containing this process in BP.

    #10496
    doug
    Moderator

    BP doesn’t currently have the built-in If/Else that you are looking for, but you can still use BP to execute the deployment as desired. To do that you would just need to create a simple script that checks the OS of the local computer, and then if it’s the desired OS the script then executes your .exe with the appropriate parameters. Then you would put the script file and the .exe together in a folder on the BP computer, and then create a deployment in BP to deploy the script to target computers. The key here is that you would be deploying the script, not the .exe. And in the deployment configuration you would check the box to “copy entire directory” so that both the script file and the .exe get copied to target computers for execution. When you execute the deployment the directory containing the two files will be copied to target computers, and then the script will be executed on target computers. Target computers that pass the OS check, per the code in your script, will then have the .exe run. Target computers that fail the OS check, per the code in your script, will not run the .exe.

    -Doug

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