Установка модуля управления обновлениями 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.

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
-NoLogo
switch, 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 -Parallel
cmdlet, 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-Json
andConvertTo-Json
cmdlets for working with JSON data, and theMicrosoft.PowerShell.GraphicalTools
module 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 update
andsudo 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.
В этой статье мы рассмотрим, как обновить версию 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.
Windows PowerShell is installed on Windows systems by default. But that’s Windows PowerShell and not PowerShell. To make the most out of PowerShell, you should upgrade to PowerShell 7. In this article, you will learn how to install and update PowerShell 7.
Table of contents
- Windows PowerShell vs PowerShell
- PowerShell versions and release date
- Find PowerShell version
- Install PowerShell 7
- Update PowerShell 7
- Frequently Asked Questions (FAQ)
- Conclusion
Windows PowerShell vs PowerShell
There are two PowerShell versions that you need to be aware of:
- Windows PowerShell (version 1.0 – 5.1)
It’s preinstalled on all modern Windows client and server OS releases. It’s not being developed further, and the latest version is 5.1. The executable is powershell.exe.
- PowerShell (version 6 and higher)
It’s not preinstalled on any version of Windows. It’s actively being developed, is much faster, and has better commands available. The executable is pwsh.exe.
Note: You can have both Windows PowerShell and PowerShell versions installed next to each other on the same system.
PowerShell versions and release date
PowerShell has gone a long way since its first release. See the table below for all the PowerShell versions and their release date.
PowerShell version | Release date |
---|---|
PowerShell 7.4 | November 2023 |
PowerShell 7.3 | November 2022 |
PowerShell 7.2 | November 2021 |
PowerShell 7.1 | November 2020 |
PowerShell 7 | March 2020 |
PowerShell 6.2 | March 2019 |
PowerShell 6.1 | September 2018 |
PowerShell 6.0 | January 2018 |
Windows PowerShell 5.1 | August 2016 |
Windows PowerShell 5.0 | February 2015 |
Windows PowerShell 4.0 | October 2013 |
Windows PowerShell 3.0 | October 2012 |
Windows PowerShell 2.0 | July 2009 |
Windows PowerShell 1.0 | November 2006 |
Find PowerShell version
Note: Windows PowerShell and PowerShell are different versions and you need to start the correct PowerShell window and run the command below.
$PSVersionTable.PSVersion
This is how it looks if you run it in Windows PowerShell.
Major Minor Build Revision
----- ----- ----- --------
5 1 20348 1
See the screenshot below.

This is how it looks if you run it in PowerShell.
Major Minor Patch PreReleaseLabel BuildLabel
----- ----- ----- --------------- ----------
7 4 0
See the screenshot below.

Method 1: One-liner
This is the fastest and easiest method to install PowerShell 7.
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
After that, you see the PowerShell 7 setup wizard that you can go through.

Ensure you enable all options.

Since PowerShell 7.2 and higher, Microsoft will automatically update PowerShell 7 in the same release channel if you enable it in the setup wizard. For example, PowerShell 7.2.x to 7.2.y and 7.3.x to 7.3.y.
Enable both options.

Finish the installation.

PowerShell 7 appears in your programs.

Method 2. Download from GitHub
Go to the PowerShell GitHub page and download the PowerShell 7 installer.

Open the PowerShell .msi file and go through the setup wizard, as shown in the above method.
Method 3: WinGet (Windows Package Manager)
Run the below command to download and install PowerShell 7.
Note: It will automatically install PowerShell 7 once downloaded, and you will not see the setup wizard.
winget install --id Microsoft.Powershell
Update PowerShell 7
It’s best to update PowerShell 7 every time a new version is out.
Use the winget upgrade command to update PowerShell 7 to the latest version.
winget upgrade --id Microsoft.PowerShell
The other methods to upgrade PowerShell 7 are to download the installer from GitHub or run the one-liner as shown above, which then you can go through the setup wizard to update PowerShell.
Frequently Asked Questions (FAQ)
How to uninstall Windows PowerShell 5.1 on Windows after installing PowerShell 7?
You don’t. It’s integrated with Windows OS, and you must leave it on your system.
Why does Windows PowerShell ISE show version 5.1 when I have PowerShell 7 installed?
PowerShell ISE loads Windows PowerShell 5.1 and not PowerShell 7.
How can I keep using Windows PowerShell ISE with PowerShell 7?
Switch over to Visual Studio Code. It’s a free, lightweight, open-source, cross-platform code editor.
Will PowerShell 7 load automatically in Visual Studio Code?
PowerShell 7 takes precedence over Windows PowerShell 5.1 and loads by default.
Can I switch between Windows PowerShell 5.1 and PowerShell 7 in Visual Studio Code?
Select a default profile and choose Windows PowerShell 5.1 or PowerShell 7.
Why doesn’t Microsoft ship PowerShell 7 with Windows?
Microsoft plans to eventually ship PowerShell 7 in Windows as a side-by-side feature with Windows PowerShell 5.1. But they still need to work out some details, and there is no timeline for when that will happen.
Should I use Windows PowerShell 5.1 or PowerShell 7?
You should definitely use PowerShell 7 when you can. But ensure you test all your cmdlets and scripts before transitioning to PowerShell 7.
Conclusion
You learned how to install and update PowerShell 7. Ensure that you use PowerShell 7 when you can because it’s kept up to date by Microsoft and performs much faster than the older versions. If it’s impossible to port some of your commands and scripts to PowerShell 7, then keep using PowerShell 5.1 for those.