> 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/guide/requirements/powershell-7.md).

# PowerShell 7

Install PowerShell 7.6 or later from the MSI package required by OSDeploy.

Install the latest stable PowerShell 7 MSI package on the OSDeploy PC. PowerShell 7 installs side by side with Windows PowerShell 5.1 and runs from `$env:ProgramFiles\PowerShell\7` by using `pwsh`.

{% hint style="warning" %}
Do not use the default WinGet command to install PowerShell for OSDeploy. Beginning with PowerShell 7.6.0, WinGet installs the MSIX package by default. That package runs from `WindowsApps`, and OSDeploy rejects it because the app-container installation does not support the required PowerShell DISM operations. Use the MSI workflow below.
{% endhint %}

## Install PowerShell

{% stepper %}
{% step %}

### Confirm the Requirements

Run these steps on a prepared [Windows 11 OSDeploy PC](/guide/requirements/windows-11-os.md) with Internet access. Open Windows PowerShell as an administrator.
{% endstep %}

{% step %}

### Download the Latest MSI

Follow Microsoft's guidance on installing the latest PowerShell 7 MSI:

{% embed url="<https://learn.microsoft.com/en-us/powershell/scripting/install/install-powershell-on-windows?view=powershell-7.6#install-the-msi-package>" %}
{% endstep %}

{% step %}

### MSI Parameters

Install PowerShell with all available options (recommended):

```powershell
$msiParams = @(
    '/package'
    'PowerShell-7.6.6-win-x64.msi'
    '/quiet'
    'ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1'
    'ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1'
    'ENABLE_PSREMOTING=1'
    'REGISTER_MANIFEST=1'
    'USE_MU=1'
    'ENABLE_MU=1'
    'ADD_PATH=1'
)
msiexec.exe @msiParams
```

See [Install the MSI package with command-line options](https://learn.microsoft.com/en-us/powershell/scripting/install/install-powershell-on-windows?view=powershell-7.6#install-the-msi-package-with-command-line-options) for details about these installer properties.
{% endstep %}

{% step %}

### Open PowerShell 7

Exit Windows PowerShell, open a new PowerShell 7 session by running `pwsh`, and inspect the installed version and location:

```powershell
$PSVersionTable | Select-Object PSEdition, PSVersion
$PSHOME
```

The output must report `Core`, PowerShell 7.6 or later, and a `$PSHOME` under `$env:ProgramFiles\PowerShell\7`. Restart Windows first if `msiexec.exe` returned exit code `3010`.
{% endstep %}

{% step %}

### Windows Terminal

Make sure to set and save PowerShell as the Default profile in Windows Terminal, replacing Windows PowerShell.

<figure><img src="https://3996045416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LDKRxGiKLYjW1gana2O%2Fuploads%2FzAgq5Or9dgB5VkMwsefs%2Fimage.png?alt=media&amp;token=04491601-bbd3-43d3-9444-6e5c2347cb2d" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

Continue to [Install PowerShell Modules](/guide/requirements/powershell-modules.md).


---

# 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/guide/requirements/powershell-7.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.
