> 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). Agents can also search and read this documentation through its [MCP server](https://www.osdeploy.com/~gitbook/mcp).

# 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](https://www.osdeploy.com/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](https://www.osdeploy.com/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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.osdeploy.com/guide/requirements/powershell-7.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
