Skip to content

Configuring Windows Run

Jesper Nielsen edited this page Mar 16, 2026 · 1 revision

Run local executables and/or download and run executables. Execute programs, scripts, or installers as part of the configuration process.

Overview

The windowsRun module executes local or remote executables with optional arguments. It handles running executables from local file paths or downloading and executing files from remote URLs. This is useful for running installers, configuration tools, or custom scripts as part of the deployment process.

The module supports two execution modes:

  • Local execution - runs existing executables from specified file paths on the device.
  • Remote execution - downloads an executable from a URL, then runs it.

For each configured executable, the module performs the following steps:

  1. Validates OS build requirements (minOSbuild and maxOSbuild)
  2. Expands Windows environment variables in file paths (e.g., %TEMP%, %ProgramFiles%)
  3. Downloads the file if downloadUri is specified (via Invoke-WebRequest)
  4. Verifies the file exists at the specified path
  5. Retrieves file version and description information for logging
  6. Executes the file with or without arguments using Start-Process
  7. Waits for process completion before continuing

All executions use -NoNewWindow -Wait flags to run processes in the same window and wait for completion before proceeding.

Configuration

The following shows the windowsRun configuration structure with two example items - one for updating a local executable and one for downloading and running an installer.

{
  "windowsRun": {
    "enabled": true,
    "items": [
      {
        "name": "Microsoft Edge",
        "description": "Update Microsoft Edge",
        "informationURL": "https://learn.microsoft.com/deployedge/deploy-edge-with-windows-10-updates/",
        "minOSbuild": "",
        "maxOSbuild": "",
        "downloadUri": "",
        "filePath": "%ProgramFiles(x86)%\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe",
        "ArgumentList": "/install appguid={56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}&appname=Microsoft%20Edge&needsadmin=True /silent"
      },
      {
        "name": "Microsoft OneDrive",
        "description": "Download and install OneDriveSetup.exe for all users",
        "informationURL": "",
        "minOSbuild": "",
        "maxOSbuild": "22621",
        "downloadUri": "https://go.microsoft.com/fwlink/p/?LinkID=2182910",
        "filePath": "%TEMP%\\OneDriveSetup.exe",
        "ArgumentList": "/allusers /silent"
      }
    ]
  }
}

Dataset properties

The following properties are supported in the windowsRun section.

Property Description Type Required
windowsRun
enabled Enable or disable the module Boolean No
items (array)
name Operation name - used for logging and readability String Yes
description Description of the executable operation - used for documentation purposes String No
informationURL URL for more information about the executable or operation String No
minOSbuild Minimum Windows build number required for this operation. Empty string means no restriction String No
maxOSbuild Maximum Windows build number allowed for this operation. Empty string means no restriction String No
downloadUri URL to download the executable before running. Empty string for local executables String No
filePath Path to the executable on the device. Supports Windows environment variables (e.g., %TEMP%, %ProgramFiles%) String Yes
ArgumentList Command-line arguments to pass to the executable String No

Reference

The commands below can be used to verify executables and inspect file properties.

Verify executable exists

Check whether an executable exists at the expected path.

Test-Path -Path "${env:ProgramFiles(x86)}\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe"

Get file version information

Retrieve the version and description of an executable.

(Get-Item -Path "${env:ProgramFiles(x86)}\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe").VersionInfo | Select-Object "FileVersion", "FileDescription", "ProductVersion"

Related resources

For more information, see the following resources.


Page revised: March 4, 2026

Clone this wiki locally