Remotely start baseline from Powershell

I’m working on a solution to automate patching via Powershell. Ideally, id like to start baselines and tasks via Powershell commands (or similar method) and get confirmation when the baseline is complete. Were currently running IBM BigFIx v9.2.8.74. From researching on the internet, i think this can be achieved via ReST api but Im not sure how to execute commands with ReST. I have been successful with getting reports via ReST cURL commands. Ive even installed the PStem Powershell BigFix cmd-lets to no avail. Does anyone have any recommendations for this?

Please see the /api/actions resource, and more specifically, the POST method against it:

https://developer.bigfix.com/rest-api/api/action.html

Here’s an example showing how to create an action using XML as input: https://developer.bigfix.com/rest-api/examples/create-action.html

The following forum post also has a good example of taking an action and referencing a source Fixlet/Baseline:

I’m new to using ReST api calls. Im following the walkthrough on https://developer.bigfix.com/rest-api/gettingstarted.html to get an understanding of how it works however i keep getting the following error when using postman

We’re working to avoid issues with plurals, but in the meantime, can you try modifying your POST’s URL to /api/actions (plural, rather than /api/action)?

Awesome! That worked for a fixlet. How would i start a baseline (that contains several tasks and fixlets)? The baseline id is 92197. I tried adding that number to the fixlet id of the previous command but i got an error.

Additionally, I dont understand the “Action” argument and what to add for a baseline.

Also, is there any training vids for this sort of thing?

Lastly, thanks @Aram for all of your help.

The same XML specifying a SourcedFixletAction should work for a baseline as well. Note that the Sitename field specified in the XML must be where the baseline resides. Here’s a sample I just tested (in my case, the baseline’s ID is 24492, and it resides in a site called “Internal Custom”):

<?xml version="1.0" encoding="UTF-8"?> <BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd"> <SourcedFixletAction> <SourceFixlet> <Sitename>Internal Custom</Sitename> <FixletID>24492</FixletID> <Action>Action1</Action> </SourceFixlet> <Target> <ComputerName>computer1</ComputerName> </Target> </SourcedFixletAction> </BES>

The Action field refers to which action you’d like to deploy (assuming a Fixlet has multiple potential actions). Here’s an example Fixlet/Task that has multiple available actions depending on the desired result:

Note the Action IDs specified (1 and 2 for instance). These are the IDs you’d specify in the XML to determine which actionscript you want to execute for the given API request.

1 Like

Oddly enough, i get an error when i added the site (based on the BigFix console). The BigFix console says Master Action Site for the baseline I’m trying to initiate however I get the following error. I even added it in quotes to no avail.

Also, how can i force the baseline to run all of the tasks, actions, and fixlets that it contains?

Lastly, id like to sync baseline before starting it too.

Oh i figured out that its called ActionSite by running a query on /api/sites

1 Like