API patch automation

Need a little direction here, we are looking to automate patching. Our manual process involves us creating a new baseline with relevant fixlets, Creating an action from that baseline, Pasting in machine names and go.

I have a script that creates the baseline, but I am at a loss on how to create an action using the baseline. In the end we will have several different actions with different sets of machine names, but all using the same baseline.

I am also having trouble creating a query that will pull the baseline info by name. I can pull them all, but I’d rather not have to parse through them since the baseline name will be always be consistent. Any help would be greatly appreciated!

You might find that using the Patch Policies in the WebUI could help with automating the application of fixlets.
https://help.hcltechsw.com/bigfix/10.0/webui/WebUI/Users_Guide/c_patch_policy_overview.html#:~:text=A%20patch%20policy%20is%20a,a%20specific%20set%20of%20endpoints.&text=To%20open%20the%20Patch%20Policy,Apps%20menu%2C%20select%20Patch%20Policies.

Thanks, we did explore this option and we do have a few policies already setup but with the number of different groups and an ever changing list of machines for each group its just easier to automate it though the API.
This is part of a bigger logic app automation that will create a change ticket in our ticketing system and notify us if any machines from the groups are not present in Bigfix so we can investigate.

1 Like

iemcli.exe post "file.xml" actions

You must first complete your master XML, which you will use to feed computers or baseline IDs during each deployment.

You can easily export any action as XML, or you can use the basic format below and simply modify the computers and fixlet ID.

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
<SourcedFixletAction>
<SourceFixlet>
<Sitename>My Test</Sitename>
<FixletID>99</FixletID>
</SourceFixlet>
<Target>
<ComputerName>XYZ</ComputerName>
</Target>
</SourcedFixletAction>
</BES>
Q: (ids of it, names of it, names of site of it) of bes fixlets whose ((display name of site of it as string as lowercase contains "my test") AND name of it = "Test Baseline" AND (custom flag of it) AND (not analysis flag of it) AND (not task flag of it) AND (not fixlet flag of it) AND (baseline flag of it))
A: 99, Test Baseline, My Test

I think I’ve provided all the missing pieces. You now need to change your script so that, after the baseline is created, it updates the xml file with the new baseline ID and target devices in addition to create an action.

Thank you for your reply, sorry for the delay in getting back to you.

Where do I specify the baseline name or ID in the XML? I already have a baseline created that has all the fixlets in it.
I need to create multiple actions to push patches to different lists of machines, but all using the same baseline as the source.

Baseline >
Action1: computer123, computer456, computer789
Action2: computer432, computer751, computer916
Action3: computer325, computer364, computer715
etc

I figured out I can use <FixletID>baseline ID</FixletID>

But I cant seem to name the action, it just uses the baseline name. I get an error when I try to use the <Title> element.

It also looks like <ComputerName> does not work. I have to use <ComputerID> or else I get “No computers meet the filter criteria” message. Is there anyway to get this to work with computername? The list of machines is coming from another system.

For the Action Title, please see below and adjust as desired.

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
<SourcedFixletAction>
<SourceFixlet>
<Sitename>My Test</Sitename>
<FixletID>99</FixletID>
</SourceFixlet>
<Target>
<ComputerName>XYZ</ComputerName>
</Target>
**<Title>API Test Baseline</Title>**
</SourcedFixletAction>
</BES>

Thats normal behavior & it does not always mean an error, BigFix relies on relevance to determine which computers are applicable for a given action. When you target by computer name, there might be a delay in name resolution and relevance evaluation.

The devices that are mentioned in your API action can be found in the Target list of your API action within the console.

When targeting by computer ID, you may see more immediate results because the ID is a unique identifier for each computer, and it doesn’t rely on name resolution or relevance evaluation.

In short both ways are fine, it just how you want to see the things.

Thank you! I was able to get this to work successfully