How to use the macOS inventory scripts as a Psuedo Agent | v8+
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:
Copy the MAC Pseudo Agent script from below. (Suggested file name csinvm.sh)
Replace <TenantID> with the valid tenant ID for the Certero platform.
Replace <EndpointServer> with the FQDN of the Endpoint Server the Mac computer can access.
Copy the script to the MAC computer
Make the script file executable
chmod +x ./csinvm.shRun the script
./csinvm.shThe inventory script could be scheduled via ‘cron’ or other scheduling tools.
MAC Pseudo Agent Script
#!/bin/bash# Parse arguments for verbose modeVERBOSE=0for arg in "$@"; do case $arg in -v|--verbose) VERBOSE=1 ;; esacdone# Certero macOS Agentless Inventory ScriptTENANT_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 dirtmpDir=$(mktemp -d) || { echo "Failed to create temp dir"; exit 4; }trap 'rm -rf "$tmpDir"' EXITcd "$tmpDir" || exit 1echo "Downloading inventory script..."curl -L -o certero-inventory.run "$INVENTORY_SCRIPT_URL" || { echo "Download failed"; exit 1; }chmod +x certero-inventory.runecho "Running inventory script..."./certero-inventory.runRC=$?[[ $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# Upload each inventory fileUPLOAD_URL="${UPLOAD_ENDPOINT}/Client/Upload?tenantId=${TENANT_ID}&e=tgz"for FILE in "${INVENTORY_FILES[@]}"; do echo "Uploading inventory: $FILE" if [[ $VERBOSE -eq 1 ]]; then curl --fail --verbose --header "Content-Type: application/octet-stream" \ --data-binary "@${FILE}" \ "$UPLOAD_URL" || { echo "Upload failed for $FILE"; exit 5; } else curl --fail --header "Content-Type: application/octet-stream" \ --data-binary "@${FILE}" \ "$UPLOAD_URL" || { echo "Upload failed for $FILE"; exit 5; } fi echo "Upload complete as: $FILE" doneExample output
Here is an example output of running the script:
consultancy@CERT-AP01 Downloads % ./csinvm.shDownloading inventory script... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 754k 100 754k 0 0 4088k 0 --:--:-- --:--:-- --:--:-- 4099kRunning 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 inventory2025-07-30 09:20:31 - INFO: Performing inventory2025-07-30 09:20:31 - INFO: Performing system information queries2025-07-30 09:20:31 - INFO: Performing processor information queries2025-07-30 09:20:31 - INFO: Querying installed modules2025-07-30 09:20:31 - INFO: Inventory process was running for 0 secondsRunning Full inventory2025-07-30 09:20:32 - INFO: Performing inventory2025-07-30 09:20:32 - INFO: Querying system profiler2025-07-30 09:20:32 - INFO: Checking installed memory2025-07-30 09:20:32 - INFO: Querying disk and partition information2025-07-30 09:20:32 - INFO: Checking disc burning capabilities2025-07-30 09:20:33 - INFO: Querying network configuration2025-07-30 09:20:33 - INFO: Checking for bluetooth adapters2025-07-30 09:20:33 - INFO: Querying graphics adapters2025-07-30 09:20:33 - INFO: Querying display information2025-07-30 09:20:34 - INFO: Querying Printer information2025-07-30 09:20:34 - INFO: Querying USB information2025-07-30 09:20:34 - INFO: Retrieving list of system groups2025-07-30 09:20:35 - INFO: Retrieving list of system users2025-07-30 09:20:35 - INFO: Retrieving list of system processes2025-07-30 09:20:35 - INFO: Retrieving list of disk free counts2025-07-30 09:20:35 - INFO: Retrieving list of machine event times2025-07-30 09:20:35 - INFO: Retrieving list of installed applications2025-07-30 09:20:35 - INFO: Retrieving list of installed fonts2025-07-30 09:20:41 - INFO: Scanning for software identification (SWID) tags2025-07-30 09:20:41 - INFO: Checking for docker2025-07-30 09:20:41 - INFO: Inventory process was running for 9 secondsChecking browser history2025-07-30 09:20:42 - INFO: Process was running for 0 secondsEnd of inventory processUploading inventory: ./mac-cert-ap01.local-24ee48775c8b557b84ceb81a0d4b663c-0.tgzUpload complete as: ./mac-cert-ap01.local-24ee48775c8b557b84ceb81a0d4b663c-0.tgzUploading inventory: ./mac-cert-ap01.local-24ee48775c8b557b84ceb81a0d4b663c-1.tgzUpload complete as: ./mac-cert-ap01.local-24ee48775c8b557b84ceb81a0d4b663c-1.tgzAlthough 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 02025-07-29 09:17:56.968 - DEBUG: Processing E:\Certero\Endpoint Server\UploadDir\Temp\1274862718\Core.ComputerSystemInventory.txt2025-07-29 09:17:56.969 - DEBUG: Processing E:\Certero\Endpoint Server\UploadDir\Temp\1274862718\Core.ComputerSystemModule.txt2025-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 Inventorymac-<computer name>-<UUID>-1.tgz is the Full Inventory