Skip to content
OSDeploy PSModule and site pages are currently in preview until mid-September
For the complete documentation index, see llms.txt. This page is also available as Markdown.

WinpeStartup Core: Add WinPE Environment Variables with a .env File

Set WinPE environment variables from a .env file in the shared WinpeStartup Core main folder.

Add a .env file to the shared WinpeStartup Core main folder to set environment variables when WinPE starts.

Add the Environment Variables

1

Create the main Folder

Create the shared folder on the OSDeploy build computer:

$MainDirectory = Join-Path $env:ProgramData 'OSDeployCore\boot-assets\winpestartup-core\main'
New-Item -Path $MainDirectory -ItemType Directory -Force | Out-Null
2

Create the .env File

Write one NAME=value entry per line. For example:

@'
CONTOSO_SITE=BranchOffice
'@ | Set-Content -LiteralPath (Join-Path $MainDirectory '.env') -Encoding utf8

Use your own variable names and values. In WinPE, read a variable in PowerShell with $env:CONTOSO_SITE.

3

Build WinPE Media

Run the build command. OSDeploy includes the shared main folder automatically when it is present:

Build-OSDeployBoot

Boot the resulting media to use the configured variables.

Last updated

Was this helpful?