
To take full advantage of its capabilities and ensure access to the latest features and cmdlets in scripts, it’s important to keep PowerShell updated. In this comprehensive guide, we’ll cover various methods to update PowerShell to the latest version and how to install or upgrade to PowerShell 7. Let’s get started!
Table of contents
- Understanding the Different Versions of PowerShell
- Updating from PowerShell 3, 4 to PowerShell 5.1
- Introduction to PowerShell 7
- Why should we update to PowerShell 7?
- Prerequisites for upgrading to PowerShell 7
- Step-by-step guide: How to update PowerShell on Windows 10/11?
- Common issues and troubleshooting during the upgrade process
- Conclusion and next steps in your PowerShell journey
Understanding the Different Versions of PowerShell
Before we dive into updating PowerShell, it’s important to understand that there are two distinct versions of PowerShell:
- Windows PowerShell: This is the classic version of PowerShell, with the latest and final version being 5.1. Microsoft is no longer actively updating Windows PowerShell because they have shifted their focus to PowerShell Core.
- PowerShell Core: This is the new, open-source, cross-platform version of PowerShell, with the current version being 7.3. PowerShell Core is built on .NET Core and is designed to be compatible with most Windows PowerShell scripts and cmdlets.
While the version numbering for PowerShell Core continues from 5.1 (6.0, 6.1, 7.0, 7.1, etc.), the two platforms are distinct and require separate update processes.
Checking Your Current PowerShell Version
- Open Windows PowerShell.
- Type the following command and press Enter:
$PSVersionTable.PSVersion
This command will display your current PowerShell version in the console.

Updating from PowerShell 3, 4 to PowerShell 5.1
PowerShell 5.1 is installed on Windows systems by default and is part of the Windows Management Framework 5.1 (which requires the .NET Framework 4.5.2 or later). It automatically updates with Microsoft Update, so ensure your system is up to date to have the latest version of PowerShell 5.1. If you are using an older version of PowerShell (such as PowerShell 3 or 4 on Windows Server 2012 R2, 2012, 2008 R2 SP1, Windows 8.1, and Windows 7 SP1), you can update to PowerShell 5.1 by installing the Windows Management Framework 5.1
Introduction to PowerShell 7
PowerShell 7, also known as PowerShell Core 7, is the latest version of PowerShell and can be installed alongside PowerShell 5.1. With the release of PowerShell 7, Microsoft has introduced a wealth of new features, performance improvements, and bug fixes, making it a must-have update for IT professionals, developers, and automation enthusiasts.
In this comprehensive guide, we will explore the benefits of updating to PowerShell 7, the key differences between PowerShell 7 and previous versions, the prerequisites for upgrading, and detailed step-by-step instructions on how to update PowerShell on various platforms. We will also delve into the new features and improvements introduced in PowerShell 7, and provide resources to help you master this powerful tool.
Let’s begin our journey toward mastering PowerShell 7!
Why should we update to PowerShell 7?
There are numerous reasons to consider updating to PowerShell 7, as it offers significant enhancements to its predecessors. Here are some compelling reasons to upgrade:
- Cross-platform compatibility: PowerShell 7 is built on .NET Core, which allows it to run on Windows, macOS, and Linux. This enables you to use the same PowerShell scripts and modules across different operating systems, streamlining your workflows and making your automation efforts more efficient.
- Improved performance: PowerShell 7 boasts enhanced performance, thanks to the underlying .NET Core runtime. This means faster script execution, reduced memory usage, and better overall performance, allowing you to accomplish your tasks more efficiently.
- New features and improvements: PowerShell 7 introduces a wealth of new features, cmdlets, and improvements, such as enhanced PowerShell remoting, improved error messages, and support for ternary operators. These enhancements make PowerShell 7 more powerful, versatile, and user-friendly.
- Long-term support: PowerShell 7 is a long-term support (LTS) release, meaning it will receive updates and bug fixes for an extended period. This ensures that your PowerShell environment remains stable, secure, and up-to-date.
- Compatibility with Windows PowerShell: PowerShell 7 offers a high level of compatibility with Windows PowerShell, allowing you to continue using your existing scripts and modules with minimal modifications. This makes the transition to PowerShell 7 smoother and less disruptive.
- Enhanced security: PowerShell 7 includes several security improvements, such as the new
-NoLogoswitch, which prevents the display of potentially sensitive information in the PowerShell console, and improved logging capabilities, which help you monitor and audit your PowerShell activities. - Pipeline parallelization: PowerShell 7 introduces the
ForEach-Object -Parallelcmdlet, which enables parallel execution of script blocks across multiple cores and threads. This can significantly improve the performance of scripts that process large amounts of data. - Additional cmdlets and modules: PowerShell 7 includes several new cmdlets and modules, such as the
ConvertFrom-JsonandConvertTo-Jsoncmdlets for working with JSON data, and theMicrosoft.PowerShell.GraphicalToolsmodule for building graphical user interfaces (GUIs). PowerShell 7 includes improved error messages.
Prerequisites for upgrading to PowerShell 7
- Supported operating systems: Ensure that you are running a compatible operating system. PowerShell 7 supports Windows 7, 8.1, 10, and 11; macOS 10.13 and later; and various Linux distributions, including Ubuntu, Debian, CentOS, Fedora, and more.
- .NET Core 3.1: PowerShell 7 requires .NET Core 3.1 to be installed on your system. You can download the latest version of .NET Core from the Official website.
- Backup your existing PowerShell configuration: Before upgrading, it is recommended to back up your existing PowerShell configuration, including profiles, scripts, and modules, to ensure a smooth transition and minimize the risk of data loss.
How to update PowerShell on Windows 10/11?
There are several methods to install or update PowerShell Core 7 on your Windows system:
Method 1: Using Winget Command
- Open a PowerShell terminal window with administrative privileges.
- To search for the available PowerShell versions, run the following command:
winget search Microsoft.Powershell
- To install the desired PowerShell Core version, use the following command:
winget install --id Microsoft.PowerShell
This will download and install the latest stable PowerShell Core release. Similarly, If you want to update your existing PowerShell 7 version to the latest build, You use:
winget upgrade --id Microsoft.PowerShell

Method 2: Using GitHub to Download PowerShell 7 Installer
- Visit the GitHub PowerShell page and select the latest release version.

- Scroll to the Assets section and download the appropriate MSI package or zip package for your operating system.
- Run the installer package and follow the installation wizard to complete the process. During installation, you can enable WSUS or Windows update to update PowerShell.

How to Update PowerShell 7 to the Latest Build?
If you have installed PowerShell 7 with an MSI, You can upgrade to the latest build by downloading and installing the latest MSI from the GitHub PowerShell page to update PowerShell 7.
Method 3: Using Microsoft Store
- Open the Microsoft Store app on your PC.
- Search for the “PowerShell” app.

- Click the Get or Update button to download and install the app on your system.
Launch PowerShell 7
After the installation, To access PowerShell 7, open the Start Menu, search for “PowerShell 7,” and select the PowerShell 7 option.

Please note that you can’t use PowerShell ISE with PowerShell 7 yet! So, use Visual Studio Code.
Verify the PowerShell 7 Version:
Open a new PowerShell console and type Get-Host. The “Version” property should display “7.x.x” (where “x” represents the version number). Ensure your existing scripts and modules work correctly in PowerShell 7. If you encounter any issues, refer to the PowerShell 7 migration guide for assistance.
Upgrading PowerShell on other platforms (Mac, Linux)
PowerShell 7 can also be installed on macOS and Linux. The installation process for these platforms is similar to Windows, with some platform-specific differences:
- macOS: Download the PowerShell 7 PKG installer from the PowerShell GitHub repository and run it. Follow the on-screen prompts to complete the installation. Verify the installation by opening a new terminal and typing
pwsh. You can also use Homebrew by runningbrew install --cask powershell. - Linux: Installation on Linux varies depending on your distribution. Follow the official documentation for detailed instructions on installing PowerShell 7 on your specific Linux distribution. For example, on Ubuntu or Debian, you can use the following commands:
sudo apt-get updateandsudo apt-get install -y powershell
Common issues and troubleshooting during the upgrade process
- Installation errors: If you encounter errors during the installation process, ensure that you have met all the prerequisites, such as installing .NET Core 3.1, and that you are using the correct installer for your system.
- Compatibility issues: If your existing scripts and modules do not work correctly in PowerShell 7, refer to the PowerShell 7 migration guide for guidance on updating your code.
- Performance issues: If you experience performance issues, such as slow script execution or high memory usage, ensure you are using the latest version of PowerShell 7 and .NET Core, and consider optimizing your scripts for parallel execution.
- Security issues: If you encounter security issues, such as unauthorized access or data breaches, review your PowerShell security settings and ensure that you are following best practices for secure scripting.
In most cases, updating PowerShell should not affect your existing scripts. However, it’s always a good practice to test your scripts with the new version of PowerShell to ensure compatibility before deploying them in a production environment.
Conclusion and next steps in your PowerShell journey
In this article, we have explored the benefits of updating to PowerShell 7, the prerequisites for upgrading, and detailed step-by-step instructions on how to update PowerShell on various platforms. By upgrading to PowerShell 7, you can take advantage of its cross-platform capabilities, improved performance, and new features and improvements.
Why should I update PowerShell?
Updating PowerShell ensures that you have access to the latest features, bug fixes, and security improvements. Newer versions of PowerShell often include performance enhancements and compatibility with the latest operating systems.
How do I check my current PowerShell version?
Should I use Windows PowerShell 5.1 or PowerShell Core 7?
Windows PowerShell 5.1 is still installed by default on Windows client and server operating systems. However, Microsoft recommends using PowerShell Core 7 whenever possible, as it will receive ongoing development and updates. It is important to test your existing scripts and modules for compatibility with PowerShell Core 7 before fully transitioning.
How do I check the version of PowerShell Core 7 after installation?
After installing PowerShell Core 7, you can check the version by opening a PowerShell Core window and running the $PSVersionTable.PSVersion command.
Can I have both Windows PowerShell and PowerShell Core 7 installed on the same system?
Yes, you can use both versions on your system since PowerShell Core 7 is installed alongside Windows PowerShell. This lets you gradually transition to PowerShell Core 7 while maintaining access to Windows PowerShell for compatibility purposes.
How do I revert to an earlier version of PowerShell if needed?
To revert to an earlier version, uninstall the current version and reinstall the version you wish to return to. For PowerShell Core, simply switch to the earlier version if you have multiple versions installed.
What is the difference between Windows PowerShell and PowerShell Core?
Windows PowerShell is the classic version of PowerShell, while PowerShell Core is the new, open-source, cross-platform version of PowerShell. Microsoft is no longer actively updating Windows PowerShell because they have shifted their focus to PowerShell Core.
Установка модуля управления обновлениями PSWindowsUpdate
В современных версиях Windows 10/11 и Windows Server 2022/2019/2016 модуль PSWindowsUpdate можно установить из онлайн репозитория PowerShell Gallery с помощью команды:
Install-Module -Name PSWindowsUpdate
Подтвердите добавление репозитариев, нажав Y. Проверьте, что модуль управлениям обновлениями установлен в Windows:
Get-Package -Name PSWindowsUpdate

Можно удаленно установить PSWindowsUpdate на другие компьютеры в сети. Следующая команда скопирует файлы модуля на указанные компьютеры (для доступа к удаленным компьютерам используется WinRM).
$Targets = "srv1.winitpro.loc", "srv2.winitpro.loc"
Update-WUModule -ComputerName $Targets -local
Политика выполнения PowerShell скриптов в Windows по умолчанию блокирует запуск командлетов из сторонних модулей, в том числе PSWindowsUpdate. Чтобы разрешить запуск любых локальных скриптов, выполните команду:
Set-ExecutionPolicy –ExecutionPolicy RemoteSigned -force
Либо вы можете разрешить запускать команды модуля в текущей сессии PowerShell:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
Импортируйте модуль в сессию PowerShell:
Выведите список доступных командлетов:
Get-command -module PSWindowsUpdate

Проверить текущие настройки клиента Windows Update:
ComputerName : WKS22122 WUServer : http://MS-WSUS:8530 WUStatusServer : http://MS-WSUS:8530 AcceptTrustedPublisherCerts : 1 ElevateNonAdmins : 1 DoNotConnectToWindowsUpdateInternetLocations : 1 TargetGroupEnabled : 1 TargetGroup : WorkstationsProd NoAutoUpdate : 0 AUOptions : 3 - Notify before installation ScheduledInstallDay : 0 - Every Day ScheduledInstallTime : 3 UseWUServer : 1 AutoInstallMinorUpdates : 0 AlwaysAutoRebootAtScheduledTime : 0 DetectionFrequencyEnabled : 1 DetectionFrequency : 4
В данном примере клиент Windows Update на компьютере настроен с помощью GPO на получение обновлений с локального сервера обновлений WSUS.
Сканировать и загрузить обновления Windows с помощью PowerShell
Чтобы просканировать компьютер на сервере обновлений и вывести список обновлений, которые ему требуется, выполните команду:
Команда должна вывести список обновлений, которые нужно установить на вашем компьютере.

Команда Get-WindowsUpdate при первом запуске может вернуть ошибку:
Value does not fall within the expected range.


Чтобы проверить, откуда получает ли Windows обновлений с серверов Windows Update в Интернете или локального WSUS, выполните команду:

В этом примере вы видите, компьютер настроен на получение обновлений с локального сервера WSUS (Windows Server Update Service = True). В этом случае вы должны увидеть список обновлений, одобренных для вашего компьютера на WSUS.
Если вы хотите просканировать ваш компьютер на серверах Microsoft Update в Интернете (кроме обновлений Windows на этих серверах содержатся обновления Office и других продуктов), выполните команду:
Вы получаете предупреждение:
Get-WUlist : Service Windows Update was not found on computer
Чтобы разрешить сканирование на Microsoft Update, выполните команду:
Чтобы убрать определенные продукты или конкретные KB из списка обновлений, которые получает ваш компьютер, вы их можете исключить по:
- Категории (-NotCategory);
- Названию (-NotTitle);
- Номеру обновления (-NotKBArticleID).
Например, чтобы исключить из списка обновления драйверов, OneDrive, и одну конкретную KB:
Get-WUlist -NotCategory "Drivers" -NotTitle OneDrive -NotKBArticleID KB4533002
Get-WindowsUpdate -Download -AcceptAll
Windows загрузит все доступные патчи сервера обновлений (MSU и CAB файлы) в локальный каталог обновлений, но не запустит их автоматическую установку.

Установка обновлений Windows с помощью команды Install-WindowsUpdate
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot
Ключ AcceptAll включает одобрение установки для всех пакетов, а AutoReboot разрешает автоматическую перезагрузку Windows после завершения установки обновлений.
Также можно использовать следующе параметры:
- IgnoreReboot – запретить автоматическую перезагрузку;
- ScheduleReboot – задать точное время перезагрузки компьютера.
Можете сохранить историю установки обновлений в лог файл (можно использовать вместо WindowsUpdate.log).
Можно установить только конкретные обновления по номерам KB:
Get-WindowsUpdate -KBArticleID KB2267602, KB4533002 -Install

Если вы хотите пропустить некоторые обновления при установке, выполните:
Install-WindowsUpdate -NotCategory "Drivers" -NotTitle OneDrive -NotKBArticleID KB4011670 -AcceptAll -IgnoreReboot
Проверить, нужна ли перезагрузка компьютеру после установки обновления (атрибуты RebootRequired и RebootScheduled):

>Просмотр истории установленных обновлений в Windows
С помощью команды Get-WUHistory вы можете получить список обновлений, установленных на компьютере ранее автоматически или вручную.

Можно получить информацию о дате установки конкретного обновления:

Вывести даты последнего сканирования и установки обновлении на компьютере:

Удаление обновлений в Windows с помощью PowerShell
Для корректного удаления обновления Windows используется командлет Remove-WindowsUpdate. Вам достаточно указать номер KB в качестве аргумента параметра KBArticleID.
Remove-WindowsUpdate -KBArticleID KB4011634
Скрыть ненужные обновления Windows с помощью PowerShell
Вы можете скрыть определенные обновления, чтобы они никогда не устанавливались службой обновлений Windows Update на вашем компьютер (чаще всего скрывают обновления драйверов). Например, чтобы скрыть обновления KB2538243 и KB4524570, выполните такие команды:
$HideList = "KB2538243", "KB4524570"
Get-WindowsUpdate -KBArticleID $HideList -Hide
или используйте alias:
Hide-WindowsUpdate -KBArticleID $HideList -Verbose

Теперь при следующем сканировании обновлений с помощью команды Get-WindowsUpdate скрытые обновления не будут отображаться в списке доступных для установки.
Вывести список скрытых обновлений:
Обратите внимание, что в колонке Status у скрытых обновлений появился атрибут H (Hidden).

Отменить скрытие обновлений можно так:
Get-WindowsUpdate -KBArticleID $HideList -WithHidden -Hide:$false
Show-WindowsUpdate -KBArticleID $HideList
Управление обновлениями Windows на удаленных компьютерах через PowerShell
Практически все командлеты модуля PSWindowsUpdate позволяют управлять обновлеями на удаленных компьютерах. Для этого используется атрибут
-Computername Host1, Host2, Host3
. На удаленных компьютерах должен быть включен и настроен WinRM (вручную или через GPO). Модуль PSWindowsUpdate можно использовать для удаленного управлений обновлениями Windows как на компьютерах в домене AD, так и в рабочей группе (потребует определенной настройки PowerShell Remoting).
Для удаленного управления обновлениями компьютерах, нужно добавить имена компьютеров доверенных хостов winrm, или настроить удаленное управление PSRemoting через WinRM HTTPS:
Или с помощью PowerShell:
Set-Item wsman:\localhost\client\TrustedHosts -Value wsk-w10BO1 -Force
С помощью Invoke-Command можно разрешить использовать модуль PSWindowsUpdate на удаленных компьютерах и открыть необходимые порты в Windows Defender Firewall (команда
Enable-WURemoting
):
Проверить список доступных обновлений на удаленном компьютере:
Get-WUList –ComputerName server2
Командлет Invoke-WUJob (ранее командлет назывался Invoke-WUInstall) создаст на удаленном компьютере задание планировщика, запускаемое от SYSTEM. Можно указать точное время для установки обновлений Windows:
Проверить статус задания установки обновлений:
Get-WUJob -ComputerName $ServerNames
Если команда вернет пустой список, значит задача установки на всех компьютерах выполнена.
Проверьте наличие обновления на нескольких удаленных компьютерах:
Получить дату последней установки обновлений на всех компьютерах в домене можно с помощью командлета Get-ADComputer из модуля AD PowerShell:
PowerShell модуль PSWindowsUpdate удобно использовать для загрузки и установки обновлений Windows из командной строки (единственный доступны вариант в случае установки обновлений на хосты без графического интерфейса: Windows Server Core и Hyper-V Server). Также этот модуль незаменим, когда нужно одновременно запустить и проконтролировать установку обновлений сразу на множестве серверов/рабочих станциях Windows.
В этой статье мы рассмотрим, как обновить версию Windows PowerShell до актуальной 5.1 и установить (обновить) PowerShell Core 7.3. В предыдущей статье мы рассказывали, что на данный момент есть две ветки PowerShell:
- старая версия Windows PowerShell (максимальная версия 5.1, которая более не развивается);
- новая платформа PowerShell Core (сейчас доступна версия 7.3).
Несмотря на то, что нумерация версий PowerShell продолжается с 5.1 (6.0, 6.1, 7.0 и т.д.), это две разные платформы. Соответственно мы отдельно рассмотрим как обновить Windows PowerShell и PowerShell Core.
PowerShell Core 7.x максимально совместима с Windows PowerShell. Это означает, что вы можете запускать свои старые скрипты и командлеты в PowerShell Core.
Обновление Windows PowerShell до 5.1
Во всех версиях, начиная с Windows 10 и Windows Server 2016, Windows PowerShell 5.1 уже установлен по-умолчанию.
В предыдущих версиях (Windows 7/8.1 и Windows 2008 R2/2012) обновление до PowerShell 5.1 нужно выполнять вручную. Например, в Windows Server 2012 R2 (Windows 8.1) установлен PowerShell 4.0.
Попробуем обновить версию Windows PowerShell в Windows Server 2012 R2 до версии 5.1.
Сначала проверьте текущую версию PowerShell (на скриншоте видно, что это PowerShell 4.0):

Чтобы обновить вашу версию PowerShell до 5.1, нужно установить пакет Windows Management Framework (WMF) 5.1, который в свою очередь требует наличия .NET Framework 4.5.2 (или более поздней версии). Убедитесь, что у вас установлена версий .NET 4.5.2 или выше командой:
(Get-ItemProperty ‘HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full’ -Name Release).Release

Установите .NET 4.8 (потребуется перезагрузка).

Если установить WMF 5.1, но не установить .NET 4.5.2 (или более новый), часть функций PowerShell не будет работать.
Установите MSU файл Windows Management Framework 5.1.

После перезагрузки сервера, запустите консоль powershell.exe и убедитесь, что версия была обновлена до PowerShell 5.1.

Если у вас остались снятые с поддержки Windows Server 2008 R2 и Windows 7, вы можете обновить на них версию PowerShell с 2.0 до 5.1 аналогичным способом. Сначала устанавливается .Net Framework 4.5.2 (или выше) и затем WMF 5.1 (ссылки загрузки будут другими, чем для Windows Server 2012 R2).
Установка/обновление PowerShell Core 7.x
PowerShell Core является кроссплатформенной и находится в стадии активной разработки (в отличии от Windows PoweShell 5.1). По сути, PowerShell Core это новая платформа, которая устанавливается в операционной системе вместе с классическим Windows PowerShell. Т.е. нельзя обновить PowerShell 5.1 до PowerShell Core 7.1. PowerShell 7 устанавливается на компьютере отдельно от Windows PowerShell 5.1 (side by side).
На данный момент доступны версии PowerShell Core 6.x и 7.x. Рекомендуется всегда устанавливать последнюю версиях PowerShell (сейчас это 7.3), если вам не требуется особая совместимость с legacy скриптами.
Вы можете обновить (установить) версию PowerShell Core в Windows 10 и 11 несколькими способами:
- С помощью MSI установщика PowerShell Core, который можно скачать на GitHub
- С помощью менеджера пакетов WinGet
- С помощью магазина приложений Microsoft
Далее мы рассмотрим все эти способы на примере обновления PowerShell Core до 7.3 в Windows 10 22H2
Обновить PowerShell Core с помощью MSI установщика

Доступны следующие опции установки:
- Add PowerShell to Path Environment Variable
- Register Windows Event Logging Manifest (для событий PowerShell будет создан отдельный журнал Event Viewer
%SystemRoot%\System32\Winevt\Logs\PowerShellCore%4Operational.evtx
) - Enable PowerShell Remoting (включает и настраивает WinRM для PowerShell Remoting)
- Add ‘Open here’ context menu to Explorer
- Add ‘Run with PowerShell 7’ context menu for PowerShell files

Далее вы можете включить автоматическое обновление PowerShell Core через WIndows Update/WSUS (рассмотрено ниже).

Для установки PowerShell Core из MSI пакета средствами SCCM/MDT/скриптами в тихом режиме можно использовать команду установки со следующими параметрами:
- ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL
- ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL
- ENABLE_PSREMOTING
- REGISTER_MANIFEST
- ADD_PATH
- DISABLE_TELEMETRY
- USE_MU – использовать Microsoft Update для получения обновлений PSCore
- ENABLE_MU – разрешить обновление PowerShell Core через Windows Update
Например, команда установки может выглядеть так:
msiexec.exe /package PowerShell-7.3.3-win-x64.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1 ADD_PATH=1 ENABLE_MU=1 ADD_PATH=1
Вы можете обновить PowerShell непосредственно из консоли. Чтобы установить или обновиться до последней версии PoSh Core, выполните команду:
Данная команда загружает установочный MSI файл PowerShell 7.3 с GitHub и запускает установку через MSI Installer.

После окончания установки открывается окно PowerShell Core (pwsh.exe), проверьте версию PowerShell и убедитесь, что теперь это PoSh 7.3.3.

Используем менеджер пакетов WinGet для установки/обновления PowerShell Core
Если у вас установлен пакетный менеджер WinGet, вы можете установить или обновить версию PowerShell до актуальной командой:
winget install --id Microsoft.Powershell --source winget
Либо можно установить конкретную версию PowerShell Core:
winget install --id=Microsoft.PowerShell -v "7.1.2" -e
При использовании менеджера пакетов Chocolatey, используйте команды (для 5.1):
choco install powershell -y
choco upgrade powershell -y
Для обновления PowerShell 7.x:
choco upgrade pwsh -y
Обратите внимание на каталоги различных версий PowerShell:
- Windows PowerShell 5.1:
$env:WINDIR\System32\WindowsPowerShell\v1.0 - PowerShell Core 6.x:
$env:ProgramFiles\PowerShell\6 - PowerShell 7.x:
$env:ProgramFiles\PowerShell\7
Если на компьютере был установлен PowerShell 6.x, то при установке PowerShell 7.3 каталог
$env:ProgramFiles\PowerShell\6
автоматически удаляется.
Обратите внимание, что имя исполняемого файла среды PowerShell изменился. Теперь это
c:\Program Files\PowerShell\7\pwsh.exe
. У него собственная иконка в меню Start.
- Для запуска Windows PowerShell, основанного на .NET Framework используется команда
powershell.exe - Для запуска PowerShell Core, основанного на .NET Core, нужно использовать команду
pwsh.exe

Т.е. теперь на этом компьютере есть две версии: Windows PowerShell 5.1 и PowerShell Core 7.3.

Чтобы узнать версию PowerShell можно проверять версию файла pwsh.exe:
(Get-Command 'C:\Program Files\PowerShell\7\pwsh.exe').Version
Так можно проверить версию файла на удаленном компьютере:
Чтобы запустить предыдущую версию PowerShell (например 4), используйте команду:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Version 4
Установка PowerShell Core через Microsoft Store
В Windows 10 и 11вы можете установить или обновить PowerShell через магазин приложений Microsoft Store. Приложение PowerShell можно найти в магазине вручную, или воспользуйтесь этой ссылкой.
Также вы можете установить магазинную версию PowerShell через WinGet:
winget search powershell --source msstore
winget install --id 9MZ1SNWT0N5D
Преимущество установки PowerShell Core через Microsoft Store в том, что магазин прилжений будет автоматически контролировать установленную версию PowerShell и автоматически устанавливать обновления по мере их появления.
Вы можете проверить, установлена ли у вас Store версия PowerShell Coreс помощью команды:
В этом примере пакет Microsoft.PowerShell_7.3.3.0_x64__8wekyb3d8bbwe установлен.

Но есть и недостатки, связанные с тем, что такой PowerShell будет запускаться в песочнице.

Установка/обновление PowerShell Core на удаленных комьютерах
Рассмотрим два сценария установки или обновления версии PowerShell Core на множестве компьютерах.
Обновление PowerShell Core с помощью GPO
В домене Active Directory вы можете централизованно установить и обновить PowerShell Core с помощью групповой политики. Воспользуйтесь возможностями установки программ с помощью MSI пакетов в GPO.
- Скачайте установочный MSI файл PowerShell и скопируйте его в каталог SYSVOL на контроллере домена;
- Откройте консоль управления доменными GPO (
gpmc.msc
), создайте новую GPO и назначьте ее на OU с компьютерами и серверами; - Перейдите в раздел GPO Computer Configuration –> Software Settings, создайте новый пакет и укажите для него путь к установочному MSI файлу PowerShell в SYSVOL;

Для более тонкого нацеливания политики на клиентов можно использовать WMI фильтры GPO.
- Для обновления групповых политик установки ПО нужно перезагрузить компьютеры. Во время загрузки на всех компьютерах будет установлена новая версия PowerShell.
Обновление PowerShell на удаленных компьютерах из командной строки
Вы можете обновлять PowerShell на удаленных компьютерах из командной строки.
- Первый способ позволяет удаленно обновить PowerShell на компьютере с помощью MSI установщика в сетевом каталоге:
Invoke-Command -ComputerName dc01 -ScriptBlock {Start-Process msiexec.exe -ArgumentList '/package "\\srv1\share\PowerShell-7.3.3-win-x64.msi" /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1' -Wait} - Следующий скрипт позволит выбрать все активные компьютеры с Windows 10 из домена Active Directory и запустить на каждом из них загрузку и установку PowerShell Core:
$creds = $(Get-Credential)
$computers = Get-ADComputer -Filter 'operatingsystem -like "*Windows 10*" -and enabled -eq "true"'
ForEach ($computer in $computers) {
Invoke-Command -ComputerName $computer -Credential $creds {iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"}
}
Будьте внимательными при использовании команд PowerShell Remoting при подключении к удаленным компьютерам (Enter-PSSession, Invoke-Command). Если вам нужно подключиться к точке управления PowerShell 7 нужно использовать команду:
Enter-PSSession -ComputerName dc01 -ConfigurationName "powershell.7"
Иначе вы подключитесь к точке PowerShell Remoting 5.1.
Обновление PowerShell в Linux дистрибутивах чаще проще всего выполняется через нативный менеджер пакетов.
Обновление PowerShell через Windows Update или WSUS
До версии PowerShell Core 7.2 не поддерживалось автоматическое обновление pwsh.exe. После выхода нового релиза в консоли появилось уведомление:
A new PowerShell stable release is available. Upgrade now, or check out the release page at: https://aka.ms/PowerShell-Release?tag=v7.1.3
Начиная с версии 7.2, PowerShell Core поддерживает автоматическое обновление через Windows Update ( Microsoft Update, Windows Update for Business, внутренний WSUS сервер или SCCM). Для этого при установке MSI пакета нужно включить соответствующие опции.
Проверьте, что в панели управления Settings -> Update and Security -> Windows Update -> Advanced Options теперь включена опция Receive updates for other Microsoft products when you update Windows.

Теперь, когда вы нажимаете кнопку Check for Updates или запускаете сканирование обновлений через модуль PSWindowsUpdate, вы также будете получать обновления для PowerShell Core.

There are a lot of different ways to update PowerShell. And that’s a good thing because it means you’ve got options. In this article, we cover several different methods to update PowerShell. Whether you prefer the terminal, a manual process, or a fully automated approach, we’ve got a method for you.
Windows PowerShell 5.1 vs. PowerShell 7.x
PowerShell comes in a couple different varieties these days and it’s important to understand the difference between them.
Windows PowerShell version 5.1
Windows PowerShell is the original version of PowerShell. Windows PowerShell, built on .NET Framework and using the Windows Management Framework (WMF), is included with Windows and Windows Server operating systems, making it the most common version of PowerShell. However, it’s no longer being actively developed, meaning it won’t receive new features going forward.
The final version of Windows PowerShell is version 5.1, which is included with Windows 10 and higher, and Windows Server 2016 and higher.
Since Windows PowerShell is not being actively developed, we won’t focus on it.
PowerShell version 7.x
PowerShell, formally known as PowerShell Core, is open source, multiplatform, and built on .NET, formerly known as .NET Core. PowerShell is in active development and receives a steady stream of updates. As of this writing, the latest version of PowerShell is 7.4.3.
How to manually update PowerShell
You can manually install updates for PowerShell by downloading and running the latest PowerShell MSI. This is the preferred update method for Windows Server. The hardest part about this whole process is finding the right installer. But that’s what I’m here for.
Once you’ve downloaded the MSI package, you’re ready to install it.
Launch the PowerShell 7.x installer.
Set your install directory. I recommend sticking with the default destination unless you have a specific need to change it. Click Next.
Select your optional actions. I recommend selecting all the options, but don’t let me tell you how to live your life. Click Next.

Select whether or not you want PowerShell to automatically update via Microsoft Update or WSUS. We’ll dive more into these update methods in the next section. Click Next.
When the installation finishes, we can launch a PowerShell window and run $PSVersionTable to return the PowerShell version number and ensure the update was successful. On my test computer, I went from version 7.4.2 to version 7.4.3.

This method really feels geared towards stubborn people like me who enjoy reminiscing about the good old days. And while I’m reminiscing, let me toss out an obligatory “get off my lawn!” Now I feel at peace.
How to update PowerShell with Microsoft Update
You can update PowerShell 7.2 and higher with Microsoft Update. To use this method, you need to ensure Receive updates for other Microsoft products when you update Windows is enabled. Here’s how to update PowerShell with Windows updates.
Right-click on the Windows Start button, then click Settings.
On Windows 10, click Update & Security. On Windows 11, click Windows Update.
Click Advanced options.
Enable Receive updates for other Microsoft products.

Here’s what the update process looks like in the Windows Update settings page. Note that this was updating PowerShell 7.4.1 to version 7.4.2.

Microsoft Update works well and is a very hands-off approach, but you are at the mercy of Microsoft’s release schedule. You may not receive a new PowerShell update until it’s been available for a couple of weeks.
How to update PowerShell with winget
Winget, the client interface of the Windows Package Manager, is a powerful command-line tool built into Windows OS that can install and update PowerShell. If you are updating PowerShell for yourself and you haven’t already automated the process, winget is probably the fastest and easiest way to do it. And if you know anything about me, you know that fastest and easiest are two of my favorite words. And no, it’s not because I’m lazy — alright, it’s because I’m lazy.
Here’s how to use winget to update PowerShell.
Launch a PowerShell or Command Prompt window.
Enter the command winget search Microsoft.PowerShell to see what version of PowerShell is currently available. You may be prompted to accept a terms-of-use agreement. If so, enter Y.

If a newer version of PowerShell is available, enter the command winget install –id Microsoft.PowerShell –source winget.
Winget should identify the newer version and install it.
The only downside to using winget is that it’s not supported on current versions of Windows Server OS. However, Windows Server 2025 should come with winget installed by default, so definitely keep this script in your back pocket.
How to automate PowerShell updates with PDQ Connect
Before we dive into the tutorial, let me show you how I have my groups in Connect configured. I have four PowerShell groups:
PowerShell Not Installed


(Note: You can ignore the first ATLA filter. That’s just to keep my test environment organized. Also, the last filter uses a variable that represents the latest version number of PowerShell, which at the time of this writing is 7.4.3.)
Now that you know how my groups are configured, let’s look at how to install PowerShell with PDQ Connect.
Launch PDQ Connect.
Click the Packages tab.
In the search field, type PowerShellto filter the results.
Select the PowerShell 7 package. This package is built and maintained by PDQ, meaning we automatically update it for you when a new version is released.
Enter the names of the devices or the device groups you want to install PowerShell on, then click Deploy. Notice that you can choose a specific update of the package to deploy if you want.

In the example above, I deployed the package to my custom group called PowerShell Not Installed. Notice that I now have three devices with the latest PowerShell version installed and one device running an older version of PowerShell.

Now it’s time to configure our automation, which will ensure that devices running an old version of PowerShell get updated.
Click the Automation tab.
Click Create automation.
Enter PowerShell for the name of the automation.
Select the PowerShell 7 package and ensure the Latest version is selected.

Select the Automatic or the Recurring automation trigger. I’m using the Recurring trigger for this example but use whichever better suits your needs.
Automatic: This trigger deploys the latest version of PowerShell to the target devices/groups as soon as a new version of the PowerShell package is available. It also immediately deploys the package to devices when they join a targeted group.
Recurring: This trigger deploys the latest version of PowerShell according to a schedule you configure.
If you choose Recurring, configure your deployment schedule. I’ve set up my automation to run every Friday at 4 p.m.

Lastly, in the Deploy tofield, add your PowerShell Old group as the target.

With the automation configured, PDQ Connect takes care of the rest and keeps your devices running PowerShell updated automatically.
If you haven’t tried PDQ Connect yet, take it for a spin with a free trial and see how easy device management can be. Since Connect is an agent-based solution, it can manage both on-prem and remote devices with ease.
How to automate PowerShell updates with PDQ Deploy & Inventory
If you don’t need to manage remote devices, PDQ Deploy & Inventory make automating PowerShell updates super easy. Because Inventory includes tons of prebuilt dynamic collections (including PowerShell collections), we don’t have to worry about creating those ourselves.
Here’s how to update PowerShell with PDQ Deploy & Inventory.
In PDQ Deploy, click Package Library.
In the filter field, type PowerShell.
Select the PowerShell 7 package, then click Download Selected (As Auto Download).

Click the New Schedule button.
Name your schedule PowerShell.
Click the Triggers tab.
Select the automation triggers you want to use. I’ll use the Weekly trigger to match the previous example.
Configure your schedule.

Click the Targets tab.
Click Choose Targets > PDQ Inventory > Collection.

Expand Collection Library > Runtimes > PowerShell > PowerShell 7, then select the PowerShell 7 (Old) collection. Click OK.
Click the Packages tab.
If the PowerShell package isn’t listed, click Attach Packages and select it.

Select the Options tab, then make sure Stop deploying to targets once they succeed is selected.

Click OK to save the schedule.
PDQ Deploy & Inventory is an agentless solution that specializes in on-prem device management. Try it for free and learn what true automation looks like.
So many options, so little time
Keeping PowerShell updated is important because it ensures you’ve got access to the latest features and keeps you safe from potential vulnerabilities.
While I recommend automating tedious tasks like this, I can’t blame you if doing things the old-fashioned way gives you that nostalgic kick you’re craving. Take your method of choice and run with it.
Now if you’ll excuse me, I’m going to go stare at the vending machine and potentially shake it a bit.

Born in the ’80s and raised by his NES, Brock quickly fell in love with everything tech. With over 15 years of IT experience, Brock now enjoys the life of luxury as a renowned tech blogger and receiver of many Dundie Awards. In his free time, Brock enjoys adventuring with his wife, kids, and dogs, while dreaming of retirement.
I’ve been using the PSWindowsUpdate module for a while now; it’s very convenient when spinning up a test VM for a customer if you want to have it up-to-date before going through the Windows Autopilot process, for example. In this blog post, I will show you how the module works with a few examples of how I use it.
How to install
Install-Module PSWindowsUpdate Import-Module PSWindowsUpdate
Available cmdlets

Examples
In the examples below, I use the PSWindowsUpdate module on a new Windows 11 Pro version 23h2 Hyper-V VM on my laptop that I deployed using the last ISO file from my VisualStudio subscription, released in December 2023. (I use it to install all updates before the Autopilot process so that the machine is up-to-date when deploying it)
Checking if updates are available
Running the Get-WindowsUpdate cmdlet will show you which updates are available to your system. You can use the -ComputerName parameter to connect to another system.

Installing all updates
Running the Install-WindowsUpdate cmdlet will install all the updates found and show you the progress during installation. You can use the -AcceptAll parameter to avoid answering confirmations.



It will prompt you to reboot the system if needed:


Retrieving the Windows Update history of a system
Running the Get-WUHistory cmdlet will show you the installed updates on the system, and you can use the -Last parameter to limit the number of updates returned in the list. For example, this will show you all the installed updates:

Or only show the last two by using -Last 2 to show the previous two updates:

Default only these properties are returned; using Format-List will show you more details:

Install or uninstall a specific Windows update
If you need to uninstall an update, use the Uninstall-WindowsUpdate cmdlet with the -KBArticleID parameter. In the example below, I (try, because it failed and you can’t always uninstall updates, especially when you’re not in Windows at that moment like me when running this in before logging in to start the Autopilot process) uninstall the KB4023057 update from the system:

And if you need to install an update, use the (You guessed it 😉 ) Install-WindowsUpdate cmdlet with the -KBArticleID parameter. In the example below, I installed the KB4052623 on the system, which was ready to be installed, which you can see because I ran the Get-WindowsUpdate command:

More information
Wrapping up
I showed you the PSWindowsUpdate module, some of its capabilities, and how to use the excellent command line method to install and manage updates using PowerShell!
When it comes to installing Windows update on Windows 10/11/8/7, most of us may want to use the Windows Update Settings feature. Sometimes, however, the Windows Updates may be stuck at downloading or some error codes.
If you want to run a custom script to automate the installation or patch a new installation, you can perform the PowerShell Windows update cmdlets with PSWindowsUpdate. How to install/manage Windows update PowerShell on Windows 10/11? Let’s keep reading.
What Is PSWindowsUpdate
When it comes to PowerShell Windows update install and management, it’s inevitable to discuss the PSWindowsUpdate module. It is an important module that can help you install or manage Windows updates from the PowerShell command lines.
How to Install/Manage Windows Updates with PowerShell
In this part, you will learn how to install Windows updates PowerShell on Windows 10/11. Besides, it also introduces other useful information related to PowerShell Windows updates, including PSWindowsUpdate install, PowerShell check for Windows updates, PowerShell Windows updates remove, etc. Let’s start exploring.
# 1. Install the PSWindowsUpdate Module
As discussed above, the PSWindowsUpdate module is necessary to make PowerShell install Windows updates. Since it is not built into Windows, you need to install it from the PowerShell Gallery. Here you can install it on Windows 10/11 and Windows Server 2022/2019/2016 via the PowerShell PackageManagement. For that:
Install-Module -Name PSWindowsUpdate -Force
Get-Package -Name PSWindowsUpdate
get-command -module PSWindowsUpdate
# 2. List All Available Windows Updates with PowerShell
Before you PowerShell install Windows updates, you can check all available Windows updates for your current computer by running the Get-WindowsUpdate or Get-WUList command in the elevated PowerShell window.
If you want to list all available updates on a remote computer, you can run Get-WUList –ComputerName server2 command.
# 3. Install All Available Windows Updates with PowerShell
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot
Get-WindowsUpdate -AcceptAll -Install -AutoReboot
After running the command, Windows 10/11 should download and install Windows Updates and automatically reboot the computer to apply these changes.
# 4. Install Specific Windows Updates with PowerShell
Here you need to replace KB5017308 with the KB name of the update you want to install.
Get-WindowsUpdate -Install -KBArticleID KB5017308
# 5. Check the Windows Updates Installed History with PowerShell
You may want to check the Windows update history with PowerShell. To do so, you can open the PowerShell window and run the Get-WUHistory command. Then you will get a list of Windows updates you installed on the computer earlier.
# 6. Remove Specific Windows Updates with PowerShell
Remove-WindowsUpdate -KBArticleID KB5017308 -NoRestart
- $HideList = “KB5017308”
- Get-WindowsUpdate -KBArticleID $HideList –Hide
Show-WindowsUpdate -KBArticleID $HideList
: If you can’t install the Windows Updates with PowerShell due to insufficient disk space, don’t worry. MiniTool Partition Wizard can help you fix the problem easily by analyzing disk space, extending partition, upgrading to a larger hard drive, etc.




