Executing BAT file on one server targeted in a group of servers

Hi all,

Any help here would be much appreciated as I am not savvy with Bigfix relevance language.

I need to execute BAT files before and after a baseline patch deployment on only one Windows server that is in a group of Windows servers. The BAT files live at the root of C:. I of course know it is simple to do this when targeting one machine, I was unsure how to do it when targeting a group. Thanks in advance.

You could add the batch file execution task into the baseline and simply put in task relevance that one specific computer name. Then you could target the action to that group and those steps would be applicable only for that one specific computer.

Does that answer to your question?

1 Like

What would be the task relevance for targeting that one server? I know how to execute the bat file, just not how to target that one server directly out of the group.

Anyone? This is a time sensitive matter.for a customer.

How about something like the following (where you replace ‘mycomputer’ with the desired one server target)?:

(computer name as lowercase) = ("mycomputer" as lowercase)

When I try running the below, I get the error “Unknown action command line 2” which is the line you provided.

(computer name as lowercase) = (“myserver” as lowercase)
run “c:\BAT scripts\test.bat”

I’m afraid you’re going to need to get a basic understanding of how BigFix works. Is there anyone at your site who could do some mentoring? Otherwise you’ll probably need to start with the “Operators Guide” documentation.

No there isn’t.

So there is no one on the forums here that can provide me with a few lines for an action script? I’m not asking for a 128 page relevant statement…

To do this within actionscript, you might consider something like the following:

if {(computer name as lowercase) = ("myserver" as lowercase)}
    run "c:\BAT scripts\test.bat"
endif

Alternatively, you could edit the source Task’s relevance so that it will only be applicable to the target machine:

Thanks.

I tried this two different ways. I made a fixlet with the above and targeted a group with the fixlet inside a baseline. Action status on all machines stated that it failed, but when looking at the action info, all lines of action script say completed on all machines and the BAT script was executed on the desired machine.

I then edited the fixlet’s relevance so that it was only applicable to the desired machine and edited the action script so it just read run “c:\test.bat”. Targeted the group with the baseline again and this time the only machine that reported back was the desired one with the same results I mentioned above.

Any idea why it says failed, but all lines of the action script in the action info say completed?

…you can change the behavior, but here are the defaults:

A Fixlet is Relevant when all of its relevance clauses evaluate to True, and Successful when the relevance changes to False. It’s intended to change the state of a machine - like going from “patch not installed” to “patch installed”.

A Task is Successful when all lines of the Action Script execute successfully.

Great thanks for the assistance. I thought that might be the case but wanted to confirm.