> For the complete documentation index, see [llms.txt](https://docs.autopilotmonitor.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.autopilotmonitor.com/reference/bootstrap-script-and-tokens.md). Agents can also search and read this documentation through its [MCP server](https://docs.autopilotmonitor.com/~gitbook/mcp).

# Bootstrap Script & Tokens

How the bootstrap script verifies and installs the agent, which guards make it skip a device, and how Bootstrap Tokens start the agent before MDM enrollment.

## The bootstrap script

Deployment is two files, and you only ever handle the first one. `Start-AutopilotMonitor.ps1` is the loader you assign as an Intune platform script (see [Deploy the Agent](https://docs.autopilotmonitor.com/getting-started/deploy-the-agent.md)); on each device it downloads `Install-AutopilotMonitor.ps1` into a folder only SYSTEM and administrators can change, checks that it carries our Authenticode signature and is a current bootstrapper, and runs it. After a successful run the folder is removed; after a failure it keeps the log for diagnosis. Under [Autopilot Device Preparation](https://docs.autopilotmonitor.com/getting-started/autopilot-device-preparation.md) a thin MSI line-of-business app delivers the same loader over the MDM channel. Assigning the bootstrapper directly instead of the loader remains supported.

The bootstrapper then:

1. Evaluates the **pre-requisite guards** — registry deployment marker, no real user profiles, no previous interactive logon, device uptime under 12 hours, no agent present. All must pass, otherwise nothing is installed: a device without an agent keeps nothing of the bootstrap, and an agent that is already there is left as it is.
2. **Downloads the agent package** from the distribution endpoint and verifies its **SHA-256 hash** against the published value — a mismatch aborts the installation.
3. **Verifies the package against its signed catalog** — every agent package carries a catalog signed by us that lists every file in it. The bootstrapper unpacks into a protected folder of its own and installs only when the catalog carries our signature and every file is present and unchanged, with nothing added; otherwise it deletes that folder and aborts.
4. Installs the agent, creates a **scheduled task running as SYSTEM**, and starts monitoring.

The full guard list with the exact checks is on the [Deploy the Agent](https://docs.autopilotmonitor.com/getting-started/deploy-the-agent.md#safe-to-assign-broadly) page, together with the read-only **dry-run tester** (`Test-ShouldBootstrapAgent.ps1`) that reports the install decision for any machine without modifying it.

{% hint style="info" %}
The script is **fail-soft by design**: any error path exits without breaking the enrollment. Monitoring is an observer — a bootstrap problem must never cost you a device rollout. Without SYSTEM or administrator rights the scripts change nothing and report an error.
{% endhint %}

The sources are public: [`scripts/Bootstrap/` on GitHub](https://github.com/okieselbach/AutopilotMonitor/tree/main/scripts/Bootstrap). The signed copies you deploy come from the download host.

## Bootstrap Tokens

*(Part of the **Bootstrap Sessions** feature — a* [*Pro plan*](https://docs.autopilotmonitor.com/plans.md) *capability, activated on request. The section appears under Settings → Tenant.)*

Normally the agent authenticates with the device's **MDM client certificate**, and the backend validates the device against your Autopilot registration. Two situations don't fit that model:

* **Very early OOBE** — the agent should start before Intune has issued the MDM certificate.
* **Pre-validation scenarios** — devices that need to register before device validation applies to them (lab devices, special provisioning flows).

Bootstrap Tokens bridge this gap: a token authenticates the session start instead of the certificate, and the agent switches to certificate authentication as soon as the MDM certificate arrives (`--await-enrollment`, default wait up to 8 hours). The script behind a token URL installs the agent with the same package check as the bootstrapper: signed catalog, every file verified.

### Managing tokens

Under **Settings → Bootstrap Sessions**, admins (and Operators granted token management) can:

* **Create** a token with a validity of 1 h, 4 h, 8 h, 24 h, 48 h, or 7 days. Each token gets a unique **short code and URL**; the copy button provides the URL and a ready-to-use **PowerShell command** for technicians or provisioning scripts.
* **Track** each token's status (Active / Expired / Revoked), creation date, expiry, creator, and **usage count**.
* **Revoke** a token at any time — revocation takes effect immediately.

{% hint style="warning" %}
Treat bootstrap tokens like credentials: choose the shortest validity that covers the job, and revoke tokens that are no longer needed. Devices registered via token still appear as normal sessions and are subject to all other tenant policies.
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.autopilotmonitor.com/reference/bootstrap-script-and-tokens.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
