> For the complete documentation index, see [llms.txt](https://docs.harmony.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.harmony.io/asset-management/ingesting-custom-script-results-from-managed-devices.md).

# Ingesting Custom Script Results from Managed Devices

Harmony lets you ingest the results of custom scripts running on managed devices directly into the platform for asset discovery and data enrichment. This ingestion path works with any MDM solution - including Kandji, JumpCloud, and others - so you are not limited to natively supported integrations.

When a script runs on a managed device, its standard output is automatically captured, compressed, and uploaded to Harmony using secure, authenticated requests. No extra configuration is required inside the script itself.

### How It Works

The ingestion flow has two main parts:

1. **Script execution** - Your MDM schedules and runs a script on managed devices as it normally would.
2. **Result upload** - The script's standard output is redirected to a temporary file, compressed, and sent to Harmony using an access key for authentication.

This approach keeps transfers efficient and ensures that only trusted devices can submit data to your Harmony environment.

### Prerequisites

Before setting up custom script ingestion, make sure you have:

* An active Harmony account with asset management permissions.
* An access key generated from the Harmony settings. Access keys are used to authenticate upload requests from your scripts.
* An MDM solution capable of deploying and scheduling scripts on managed devices (any MDM platform is supported).

### Setting Up Access Key Authentication

Access keys ensure that only authorized devices can submit script results to Harmony. To generate an access key:

1. Navigate to **Settings** in Harmony.
2. Open the **Access Keys** section.
3. Select **Create Access Key** and give it a descriptive name so you can identify which integration it belongs to.
4. Copy the generated key and store it securely - you will reference it in the upload step of your script.

Keep your access key confidential. If a key is compromised, rotate it immediately from the same settings page.

### Writing a Custom Script

Your script does not need any special logic to handle uploads. Harmony captures standard output automatically. Focus the script on collecting the data you want - hardware inventory, installed software, configuration details, or any other asset information.

A typical script structure looks like this:

1. Collect the data you need (for example, system profiler output, installed package lists, or custom inventory fields).
2. Print the results to standard output.
3. Exit cleanly.

The upload wrapper handles compression and transmission after your script finishes.

### Automatic Result Capture and Upload

When the script runs on a managed device, Harmony's upload mechanism:

* **Redirects standard output** to a temporary file on the device.
* **Compresses the file** before transmission to keep the payload small and transfers fast.
* **Sends the compressed result** to Harmony using your access key in the authentication header.

This happens automatically without any changes to the script itself. Once the data arrives in Harmony, it is processed and made available for asset discovery and enrichment.

### Supported MDM Platforms

This ingestion method works alongside any MDM solution. Platforms that have been validated include:

* **Kandji**
* **JumpCloud**
* Any other MDM capable of running shell or Python scripts on managed endpoints

If your MDM can deploy a script and schedule its execution, it is compatible with this feature.

### Firewall and Network Considerations

The upload uses standard HTTPS outbound traffic, making it compatible with most corporate firewall policies without requiring special rules. Ensure managed devices can reach the Harmony API endpoint on port 443.

### Troubleshooting

| Symptom                                             | Likely Cause                                          | Resolution                                                                          |
| --------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------- |
| Upload fails with an authentication error           | Access key is missing or incorrect                    | Verify the key in your script matches the one generated in Harmony settings         |
| No results appear in Harmony after script runs      | Script produced no standard output                    | Confirm the script prints output and exits with a zero status code                  |
| Compressed file is empty                            | Script exited before producing output due to an error | Check the script's error output via your MDM console for runtime failures           |
| Data appears in Harmony but fields are not enriched | Output format is not recognized                       | Review the expected output format in the Harmony documentation for your script type |

### Next Steps

* Review the asset discovery dashboards in Harmony to confirm ingested data is appearing correctly.
* Schedule your script on a recurring basis through your MDM to keep asset data up to date.
* Use access key rotation as part of your regular security hygiene to minimize exposure.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.harmony.io/asset-management/ingesting-custom-script-results-from-managed-devices.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
