Take action on Computername instead of ID

Is there a way I can take action on a computer name as opposed to a computer id number? Im trying to script a way to patch and ideally id be able to use the hostname as opposed to computer id.

Yes, you can specify a Computer name rather than ID for the target. Per the bes_xsd schema (https://developer.bigfix.com/rest-api/bes_xsd.html):

<xs:complexType name="BESActionTarget">
<xs:choice>
  <xs:element name="ComputerName" type="xs:normalizedString" maxOccurs="unbounded" />
  <xs:element name="ComputerID" type="xs:nonNegativeInteger" maxOccurs="unbounded" />
  <xs:element name="CustomRelevance" type="xs:normalizedString" maxOccurs="1"/>
  <xs:element name="AllComputers" type="xs:boolean" maxOccurs="1" />
</xs:choice>

</xs:complexType>

Here’s an example using a SourcedFixletAction:

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

When i try using the sourcedfixlet action on a fixlet i created in Master Site, it does not work, i get the below error:
{“format”:“Unexpected server error: {message}”,“arguments”:[“Site “Master” does not exist.”

Although the fixlet is present under the Master operator Site, don’t know why am i getting the above message

Also, when i try to replace the ComputerID with computerName, the action does not display the computer although the action got created correctly, any help/suggestion?

I believe the actual site name for the Master Action Site is ‘actionsite’.

1 Like

And further, it may be case sensitive. I just successfully tested the following XML against /api/actions:

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

As an additional note, you can check/confirm the site names via /api/sites

Thanks Jason/Aram, it is working now, it was ‘Actionsite’ for Master operator site
Now just need to build the logic to place all the computer IDs in the xml logic and make it time out after few hours