Problems using If specified file exists in job queue

BatchPatch Forums Home Forums BatchPatch Support Forum Problems using If specified file exists in job queue

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #12413
    suew
    Participant

    I’ve been fighting with exit codes in powershell scripts not always making it back correctly when deploying the scripts (I suspect they’re being swallowed by the cmd.exe), so I decided to try using the built-in “If specified file exists, goto” to replace one of my scripts.

    The file is under the “Program Files (x86)” directory. When I query for the file existence using the Get information > Check if file exists function, it works just fine. However, when I try the same thing in the job queue, it fails. The message returns “File Existence: FALSE: C:\Program Files (x86 does not exist.”

    It seems to have a problem with parenthesis. I’ve tried both with quotes and without, but no luck.

    Any suggestions?

    #12414
    suew
    Participant

    Just another issue. I have the same problem if I use the If version of specified file is older/newer than Y, goto X.

    #12415
    doug
    Moderator

    You found a bug. Thank you for reporting this. We will have all four of those job queue items fixed in the next release.

    In the meantime we have a few custom script integration examples posted at the following links. These examples are written in vbscript, not powershell, but they might help give you some ideas for how you could accomplish your goal. For example if you want to have the job queue check for file existence or file version on a file that is currently failing due to the parenthesis bug/issue you described above, you could use a script that checks for the existence of the file and then returns 0 or 1 depending on whether or not it finds the file. Then in BatchPatch you could create a Deployment job to execute the script, and then insert that Deployment job in the Job Queue right before using the step ‘If previous action failed/errored (returned non-0), goto label:X’ or ‘If previous action was successful (returned 0), goto label:X’

    https://batchpatch.com/advanced-script-integration-with-batchpatch

    https://batchpatch.com/batchpatch-custom-script-integration-install-windows-updates-only-after-stopping-a-specified-service

    https://batchpatch.com/advanced-script-integration-with-batchpatch-part-2

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