> 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/powershell-modules/osdcloud/invoke-winpestartup.md).

# Invoke-WinPEStartup

Runs the WinPE startup workflow for OSDCloud.

| Property | Value                              |
| -------- | ---------------------------------- |
| Module   | OSDCloud                           |
| Platform | WinPE only (`SystemDrive == X:`)   |
| Requires | OSDCloud module, WinPE environment |

{% hint style="info" %}
This function only runs in WinPE. When called from a full Windows OS, it writes a warning and exits without performing any actions.
{% endhint %}

## Description

Executes the OSDCloud WinPE startup sequence from a single entry point. Optionally loads defaults from module JSON, discovers and applies a startup profile, then runs startup steps in order: environment setup, drivers, files, hardware checks, connectivity, module updates, script execution, and optional URL or command invocations.

HTTP and HTTPS entries in `-InvokeStartupCommand`, `-InvokeMainCommand`, and `-InvokeShutdownCommand` are automatically wrapped as `Invoke-RestMethod -Uri <url> | Invoke-Expression`.

## Syntax

```powershell
Invoke-WinPEStartup
    [-SkipOnScreenKeyboard]
    [-ShowPnpDevices]
    [-ShowPnpErrors]
    [-SkipWiFi]
    [-SkipIPConfig]
    [-SkipUpdateOSDCloud]
    [-InstallModule <String[]>]
    [-InvokeStartupCommand <String[]>]
    [-InvokeStartupCommandNoExit]
    [-InvokeStartupCommandEA <String>]
    [-InvokeMainCommand <String[]>]
    [-InvokeMainCommandNoExit]
    [-InvokeMainCommandEA <String>]
    [-InvokeShutdownCommand <String[]>]
    [-InvokeShutdownCommandNoExit]
    [-InvokeShutdownCommandEA <String>]
```

## Parameters

| Parameter                      | Type       | Default    | Description                                                                             |
| ------------------------------ | ---------- | ---------- | --------------------------------------------------------------------------------------- |
| `-SkipOnScreenKeyboard`        | `Switch`   | —          | Skips launching the on-screen keyboard check.                                           |
| `-ShowPnpDevices`              | `Switch`   | —          | Shows the PnP device hardware window (`Show-WinPEStartupDevices`). Hidden by default.   |
| `-ShowPnpErrors`               | `Switch`   | —          | Shows the PnP device error window (`Show-WinPEStartupDeviceErrors`). Hidden by default. |
| `-SkipWiFi`                    | `Switch`   | —          | Skips Wi-Fi startup and connection checks.                                              |
| `-SkipIPConfig`                | `Switch`   | —          | Skips displaying IP configuration details.                                              |
| `-SkipUpdateOSDCloud`          | `Switch`   | —          | Skips updating the OSDCloud module during startup.                                      |
| `-InstallModule`               | `String[]` | —          | One or more additional PowerShell module names to install or update during startup.     |
| `-InvokeStartupCommand`        | `String[]` | —          | PowerShell commands or URLs to execute during the startup phase.                        |
| `-InvokeStartupCommandNoExit`  | `Switch`   | —          | Keeps the child PowerShell window open after startup commands complete.                 |
| `-InvokeStartupCommandEA`      | `String`   | `Continue` | Error action for the startup command child process. Valid values: `Continue`, `Stop`.   |
| `-InvokeMainCommand`           | `String[]` | —          | PowerShell commands or URLs to execute during the main phase.                           |
| `-InvokeMainCommandNoExit`     | `Switch`   | —          | Keeps the child PowerShell window open after main commands complete.                    |
| `-InvokeMainCommandEA`         | `String`   | `Continue` | Error action for the main command child process. Valid values: `Continue`, `Stop`.      |
| `-InvokeShutdownCommand`       | `String[]` | —          | PowerShell commands or URLs to execute during the shutdown phase.                       |
| `-InvokeShutdownCommandNoExit` | `Switch`   | —          | Keeps the child PowerShell window open after shutdown commands complete.                |
| `-InvokeShutdownCommandEA`     | `String`   | `Continue` | Error action for the shutdown command child process. Valid values: `Continue`, `Stop`.  |

## Examples

```powershell
# Run the default WinPE startup sequence
Invoke-WinPEStartup
```

```powershell
# Run with detailed verbose output
Invoke-WinPEStartup -Verbose
```

```powershell
# Skip Wi-Fi and IP configuration steps
Invoke-WinPEStartup -SkipWiFi -SkipIPConfig
```

```powershell
# Run a PSCloudScript URL during the main phase
Invoke-WinPEStartup -InvokeMainCommand 'https://raw.githubusercontent.com/OSDeploy/OSDCloud/main/Deploy-OSDCloud.ps1'
```


---

# 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://www.osdeploy.com/powershell-modules/osdcloud/invoke-winpestartup.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.
