> For the complete documentation index, see [llms.txt](https://www.osdeploy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.osdeploy.com/osdeploy-insider/how-to/osdeploy-boot-add-new-winpe-startup-profile.md).

# OSDeploy Boot: Add a New WinpeStartup Profile

Create a WinpeStartup profile that runs OSDCloud automatically and restarts after a successful deployment.

Create a custom WinpeStartup profile to display device information, start OSDCloud automatically, and restart the device after the deployment command completes successfully.

{% hint style="warning" %}
This profile starts deployment without leaving an interactive PowerShell window open and restarts immediately after `Deploy-OSDCloud` returns successfully. Test the profile before using it in production.
{% endhint %}

## Create the Profile

Create the shared profile directory and write `OSDCloud Restart.json`:

```powershell
$ProfileDirectory = Join-Path $env:ProgramData `
    'OSDeployCore\boot-assets\winpestartup-profiles'
$ProfilePath = Join-Path $ProfileDirectory 'OSDCloud Restart.json'

New-Item -Path $ProfileDirectory -ItemType Directory -Force | Out-Null

@'
{
  "env": {
    "WINPESTARTUP_AUTHOR": "OSDeploy",
    "WINPESTARTUP_PROFILE": "OSDCloud Restart"
  },
  "Invoke-WinpeStartup:InvokeMainCommand": [
    "Show-OSDCloudDeviceInfo",
    "Deploy-OSDCloud"
  ],
  "Invoke-WinpeStartup:InvokeMainCommandEA": "Stop",
  "Invoke-WinpeStartup:InvokeShutdownCommand": [
    "Restart-Computer -Force"
  ],
  "Invoke-WinpeStartup:InvokeShutdownCommandEA": "Stop"
}
'@ | Set-Content -LiteralPath $ProfilePath -Encoding utf8
```

`InvokeMainCommandEA` is set to `Stop` so a failed main command stops startup instead of continuing to the restart phase. The profile omits `InvokeMainCommandNoExit`; setting it to `true` would keep the child PowerShell session open and delay the restart until that window closes.

## Validate the JSON

Parse the file without executing any commands stored in it:

```powershell
$Profile = Get-Content -LiteralPath $ProfilePath -Raw | ConvertFrom-Json
$Profile |
    Format-List
```

Confirm that the output contains one `env` object, the two main commands, and the restart command. Do not define both `env` and `Environment` in the same profile.

## Add the WinpeStartup Profile to a Build

Start an interactive build:

```powershell
Build-OSDeployBoot
```

Select `OSDCloud Restart.json` when the WinpeStartup profile picker appears, then complete the remaining prompts. OSDeploy copies the selected JSON into `WinpeStartup\profiles` in the mounted image. Profile choices are sorted by name. Select only this WinpeStartup profile when startup must be automatic; including multiple WinpeStartup profiles causes a numbered selection prompt in WinPE.

## Test the Startup Flow

Boot the generated ISO in a test virtual machine before using physical hardware. Confirm this sequence:

1. WinPE starts and establishes the required network connection.
2. OSDCloud device information is displayed.
3. `Deploy-OSDCloud` starts.
4. A successful return from the deployment command triggers `Restart-Computer -Force`.
5. A terminating deployment error prevents the shutdown phase from running.

See the [WinpeStartup Profile Agent](/osdeploy-insider/agents-skills/winpestartup-profile-agent.md) for every supported property and validation rule.


---

# 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://www.osdeploy.com/osdeploy-insider/how-to/osdeploy-boot-add-new-winpe-startup-profile.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.
