How to use the macOS inventory scripts as a Psuedo Agent | v8+

certero logo_cropped_png-01 1.png

With Remote Inventory, an endpoint server is connecting to a Linux or Unix computer, copying the inventory script file and then executing the script. With the Pseudo agent, it is the client computer that is initiating the communication. Connecting to the endpoint server, to retrieve the inventory script. Executing the script and then uploading the inventory file to the endpoint server.

For Mac computers, customers can perform Remote Inventory or install the Mac version of the Certero Client agent. Endpoint servers do have an agentless inventory script for mac computers, called csinvm-agentless-x86_64.run. For instances where you wish to call the psuedo agent and upload inventory files, you can follow the below process:

 

  1. Copy the MAC Pseudo Agent script from below. (Suggested file name csinvm.sh)

  2. Replace <TenantID> with the valid tenant ID for the Certero platform.

  3. Replace <EndpointServer> with the FQDN of the Endpoint Server the Mac computer can access.

  4. Copy the script to the MAC computer

  5. Make the script file executable

    chmod +x ./csinvm.sh
  6. Run the script

    ./csinvm.sh
  7. The inventory script could be scheduled via ‘cron’ or other scheduling tools.

MAC Pseudo Agent Script

#!/bin/bash
# Parse arguments for verbose mode

VERBOSE=0

for arg in "$@"; do
case $arg in
-v|--verbose)
VERBOSE=1
;;
esac
done

# Certero macOS Agentless Inventory Script
TENANT_ID="<TenantID>"
UPLOAD_ENDPOINT="https://<EndpointServer>/CerteroEndPointServer"
INVENTORY_SCRIPT_URL="https://<EndpointServer>/CerteroEndpointServer/Client/Apple/csinvm-agentless-x86_64.run"

# Create and switch to temp dir
tmpDir=$(mktemp -d) || { echo "Failed to create temp dir"; exit 4; }
trap 'rm -rf "$tmpDir"' EXIT
cd "$tmpDir" || exit 1
echo "Downloading inventory script..."
curl -L -o certero-inventory.run "$INVENTORY_SCRIPT_URL" || { echo "Download failed"; exit 1; }
chmod +x certero-inventory.run
echo "Running inventory script..."
./certero-inventory.run
RC=$?
[[ $RC -ne 0 && $RC -ne 255 ]] && { echo "Script failed with code $RC"; exit 2; }

# Locate all inventory files.
INVENTORY_FILES=( $(find . -type f -name "mac-*.tgz") )
if [[ ${#INVENTORY_FILES[@]} -eq 0 ]]; then
echo "No inventory files found"; exit 3;
fi

Example output

Here is an example output of running the script:

consultancy@CERT-AP01 Downloads % ./csinvm.sh
Downloading inventory script...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 754k 100 754k 0 0 4088k 0 --:--:-- --:--:-- --:--:-- 4099k

Running inventory script...
Verifying archive integrity... 100% MD5 checksums are OK. All good.
Uncompressing Certero Agentless Client for macOS x86_64 100%

******************************************************************
* *
* Certero client inventory tool *
* Copyright(c) Certero 2024. All rights reserved. *
* *
* O/S : Mac OS X 13.7.6 *
* Arch : x86_64 *
* Info : http://www.certero.com *
* Email : help@certero.com *
* *
******************************************************************

Running Core inventory
2025-07-30 09:20:31 - INFO: Performing inventory
2025-07-30 09:20:31 - INFO: Performing system information queries
2025-07-30 09:20:31 - INFO: Performing processor information queries
2025-07-30 09:20:31 - INFO: Querying installed modules
2025-07-30 09:20:31 - INFO: Inventory process was running for 0 seconds

Running Full inventory
2025-07-30 09:20:32 - INFO: Performing inventory
2025-07-30 09:20:32 - INFO: Querying system profiler
2025-07-30 09:20:32 - INFO: Checking installed memory
2025-07-30 09:20:32 - INFO: Querying disk and partition information
2025-07-30 09:20:32 - INFO: Checking disc burning capabilities
2025-07-30 09:20:33 - INFO: Querying network configuration

Although the output shows the inventory filenames being as mac-<computer name>-<UUID>-n.tgz, the filenames used in the upload are <tenantid>.tgz. Multiple files called <tenantid>.tgz can be uploaded, one at a time, to the endpoint server but they are saved in the UploadDir folder on the endpoint server as nnnnnnnn.tgz. The exact number of digits (n) will vary as the endpoint server has an inbuilt counter that keeps increasing. You can see the filenames referenced in the CollectionService_YYYYMMDD.log file in the endpoint server logs folder.

E.G.

2025-07-29 09:17:56.909 - INFORMATION: Processing file [1274862718.tgz]
2025-07-29 09:17:56.968 - DEBUG: Started executing 'ProcessFile' method in module 0
2025-07-29 09:17:56.968 - DEBUG: Processing E:\Certero\Endpoint Server\UploadDir\Temp\1274862718\Core.ComputerSystemInventory.txt
2025-07-29 09:17:56.969 - DEBUG: Processing E:\Certero\Endpoint Server\UploadDir\Temp\1274862718\Core.ComputerSystemModule.txt
2025-07-29 09:17:56.970 - DEBUG: Processing E:\Certero\Endpoint Server\UploadDir\Temp\1274862718\Core.ComputerSystemProcessorInfo.txt


To review, the inventory filenames created on the mac have one naming standard. They are received on the endpoint server in a different naming standard. But the files contents are the same. The Mac agentless inventory script (csinvm-agentless-x86_64.run) will produced at least two inventory files (but possibly more).


E.G.

mac-<computer name>-<UUID>-0.tgz is the Core Inventory
mac-<computer name>-<UUID>-1.tgz is the Full Inventory