WinPEStartup Profile Agent
Agent instructions for creating, editing, and validating WinPEStartup Profile JSON files for OSDeploy Boot and OSDCloud.
Use these instructions to create, edit, or validate a WinPEStartup Profile JSON file that configures Invoke-WinPEStartup.
Agent contract
Determine whether the user wants to create, edit, or validate a profile. Extract the requested filename and behavior before changing a file.
Follow these rules:
Proceed without questions when the request includes a profile name and enough behavioral detail.
Ask one concise group of questions only when choices that materially affect the profile remain unresolved.
Add the
.jsonextension when the user omits it.Accept a filename only. Reject rooted paths, path separators,
., and...Create or edit the JSON file directly. Do not use or recommend an OSDeploy function to author it.
Do not write a profile into an installed PowerShell module directory.
Use one JSON object with exact
Invoke-WinPEStartup:property names and, when needed, oneenvmetadata object.Use native JSON booleans and arrays of strings. Do not use quoted booleans, comments, unsupported properties, or nested objects other than
env.Omit unrequested properties so they inherit OSDCloud defaults.
Do not emit empty arrays unless the user explicitly wants to clear an inherited collection.
Read an existing profile before changing it and preserve unrelated supported properties and formatting where practical.
Ask before replacing an existing profile unless the user explicitly requested replacement.
For a validation-only request, do not modify the file.
Never execute commands or URLs stored in a profile during validation.
Authoring modes
Use automatic mode when the user supplies a profile name and enough detail to create or update it.
Use guided mode when required behavior is missing or ambiguous. Ask only about unresolved choices such as:
A descriptive profile filename.
Commands or URLs for the startup, main, and shutdown phases.
Additional PowerShell modules to install or update.
Skip or display settings.
Whether a child PowerShell process must remain open.
Whether command failure should continue startup or stop it.
Prefer selectable answers for fixed choices and free text for filenames, modules, commands, and URLs. Group related questions into one interaction.
Use these conservative defaults:
Inherit omitted OSDCloud settings.
Keep child PowerShell processes non-interactive by omitting
NoExit.Use
Continueunless a failed command must stop startup.Put preparation commands in the startup phase, deployment or inspection commands in the main phase, and restart commands in the shutdown phase.
Profile destination
Create new profiles at:
Create the winpestartup-profiles directory when it does not exist.
An OSDeploy Boot profile can also contain JSON files in its local WinPEStartup\profiles directory. Those files are copied automatically during a build, but the shared Boot-Assets library is the standard destination for newly authored profiles.
Configuration reference
env
object
Define environment-variable metadata as string, number, or boolean values.
Invoke-WinPEStartup:SkipOnScreenKeyboard
boolean
Skip the on-screen keyboard check.
Invoke-WinPEStartup:ShowPnpDevices
boolean
Show Plug and Play device hardware.
Invoke-WinPEStartup:ShowPnpErrors
boolean
Show Plug and Play device errors.
Invoke-WinPEStartup:SkipWiFi
boolean
Skip Wi-Fi startup and connection checks.
Invoke-WinPEStartup:SkipIPConfig
boolean
Skip the IP configuration display.
Invoke-WinPEStartup:SkipUpdateOSDCloud
boolean
Skip the OSDCloud module update.
Invoke-WinPEStartup:InstallModule
string array
Install or update additional PowerShell modules.
Invoke-WinPEStartup:InvokeStartupCommand
string array
Run preparation commands before the main phase.
Invoke-WinPEStartup:InvokeStartupCommandNoExit
boolean
Keep the startup child PowerShell process open.
Invoke-WinPEStartup:InvokeStartupCommandEA
Continue or Stop
Handle startup child-process failure.
Invoke-WinPEStartup:InvokeMainCommand
string array
Run deployment, inspection, or other primary commands.
Invoke-WinPEStartup:InvokeMainCommandNoExit
boolean
Keep the main child PowerShell process open.
Invoke-WinPEStartup:InvokeMainCommandEA
Continue or Stop
Handle main child-process failure.
Invoke-WinPEStartup:InvokeShutdownCommand
string array
Run final commands after the main phase.
Invoke-WinPEStartup:InvokeShutdownCommandNoExit
boolean
Keep the shutdown child PowerShell process open.
Invoke-WinPEStartup:InvokeShutdownCommandEA
Continue or Stop
Handle shutdown child-process failure.
Apply these inheritance rules:
Use
envfor profile metadata such asWINPESTARTUP_AUTHORandWINPESTARTUP_PROFILE. Do not add bothenvand its supported alias,Environment.An omitted property inherits the OSDCloud default.
An explicit boolean overrides its inherited value.
A string array replaces the inherited collection. An empty array intentionally clears it.
Continuewrites a warning and proceeds after a child-process failure.Stopraises a terminating error.Explicit
Invoke-WinPEStartuparguments override profile values. Profile values override OSDCloud module defaults.
Command behavior
Store each command, module, or URL as one array entry. Entries execute in order in one child Windows PowerShell process for that phase, so state created by an earlier command is available to later commands in the same phase.
Use the phase that matches the command's purpose:
Use
InvokeStartupCommandfor preparation after connectivity and module updates.Use
InvokeMainCommandfor device inspection, deployment, and the primary task.Use
InvokeShutdownCommandfor final actions such as restarting the device.
A command entry beginning with http:// or https:// is converted by Invoke-WinPEStartup to:
Write the URL directly in the profile. Do not wrap it in Invoke-RestMethod.
Use Restart-Computer -Force to restart after deployment. Use shutdown.exe only when its specific options are required.
Set a phase's NoExit property only when the user requests an interactive child PowerShell window. Invoke-WinPEStartup waits for that process to close.
Bundled module examples
Use the profiles bundled in OSDeploy\core\winpestartup-profiles and OSDCloud\core\winpestartup-profiles as authoring examples. Treat files in installed module directories as read-only references; create user-authored profiles in the shared Boot-Assets library.
The bundled Default.json profile displays OSDCloud device information and keeps the main child PowerShell process open:
The bundled Recovery Environment.json profile starts Windows Recovery Environment and keeps its main child PowerShell process open:
The bundled OSDCloud OSDCloud.json profile displays device information, starts an OSDCloud deployment, and keeps the main child PowerShell process open:
Build and runtime lifecycle
Build-OSDeployBootincludes JSON files from the shared user repository in its WinPEStartup profile selector.Selected paths are saved in the build profile's
WinPEStartupProfileproperty.The build copies selected files into
WinPEStartup\profilesin the mounted WinPE image.In WinPE,
Invoke-WinPEStartupscans drivesC:throughZ:for<drive>:\WinPEStartup\profiles\*.json.One discovered profile is selected automatically. Multiple profiles produce a numbered selection prompt.
Cancelling the prompt or selecting a malformed profile stops the remaining startup sequence. A malformed profile also produces a warning.
Authoring workflow
Validate the profile
After creating or editing a profile, parse and type-check it with PowerShell. Use the same procedure for a validation-only request. This code reads profile values but never invokes a stored command:
Before completing the request, confirm that:
The result is one object with at least one explicit setting.
Every top-level property is
env,Environment, or a supportedInvoke-WinPEStartup:property.The profile does not contain both
envandEnvironment.Environment-variable names are valid and their values are strings, numbers, or booleans.
Switch-like settings are booleans.
Module and command settings are arrays containing only non-empty strings.
Error-action values are
ContinueorStop.Command order matches the requested execution order.
The resulting values match the user's requested behavior.
Validation did not execute any profile command or URL.
The runtime loader may tolerate JSON comments, but standard JSON validation does not. Do not add comments to a profile.
Last updated
Was this helpful?

