Screenshot of a PowerShell 7 session in Windows Terminal | |
| Paradigm | Imperative, pipeline, object-oriented, functional and reflective |
|---|---|
| Designed by | Jeffrey Snover, Bruce Payette, James Truher (et al.) |
| Developer | Microsoft |
| First appeared | November 14, 2006; 17 years ago |
| Stable release | |
| Typing discipline | Strong, safe, implicit and dynamic |
| Implementation language | C# |
| Platform | PowerShell: .NET Windows PowerShell: .NET Framework |
| OS | |
| License | MIT License[2] (but the Windows component remains proprietary) |
| Filename extensions |
|
| Website | |
| Influenced by | |
| Python, Ksh, Perl, C#, CL, DCL, SQL, Tcl, Tk,[3] Chef, Puppet | |
PowerShell includes its own extensive, console-based help (similar to man pages in Unix shells) accessible via the Get-Help cmdlet. Updated local help contents can be retrieved from the Internet via the Update-Help cmdlet. Alternatively, help from the web can be acquired on a case-by-case basis via the -online switch to Get-Help.


- cmdlets (.NET Framework programs designed to interact with PowerShell)
- PowerShell scripts (files suffixed by
.ps1) - PowerShell functions
- Standalone executable programs
Extended Type System
The number of cmdlets included in the base PowerShell install has generally increased with each version:
| Version | Cmdlets | Ref |
|---|---|---|
| Windows PowerShell 1.0 | [38] | |
| Windows PowerShell 2.0 | [39] | |
| Windows PowerShell 3.0 | [40] | |
| Windows PowerShell 4.0 | ? | |
| Windows PowerShell 5.0 | [41] | |
| Windows PowerShell 5.1 | [] | |
| PowerShell Core 6.0 | ? | |
| PowerShell Core 6.1 | ? | |
| PowerShell Core 6.2 | ? | |
| PowerShell 7.0 | [] | |
| PowerShell 7.1 | ? | |
| PowerShell 7.2 | ? | |
| PowerShell 7.4 |
# Definition of static parameters # Definition of dynamic parameters # Set of instruction to run at the start of the pipeline # Main instruction sets, ran for each item in the pipeline # Set of instruction to run at the end of the pipeline
Desired State Configuration
Upon running a configuration, DSC will ensure that the system gets the state described in the configuration. DSC configurations are idempotent. The Local Configuration Manager (LCM) periodically polls the system using the control flow described by resources (imperative pieces of DSC) to make sure that the state of a configuration is maintained.
Initially using the code name “Monad”, PowerShell was first shown publicly at the Professional Developers Conference in October 2003 in Los Angeles. All major releases are still supported, and each major release has featured backwards compatibility with preceding versions.
Windows PowerShell 1.0

Windows PowerShell 2.0

Windows PowerShell 3.0
- Scheduled jobs: Jobs can be scheduled to run on a preset time and date using the Windows Task Scheduler infrastructure.
- Session connectivity: Sessions can be disconnected and reconnected. Remote sessions have become more tolerant of temporary network failures.
- Improved code writing: Code completion (IntelliSense) and snippets are added. PowerShell ISE allows users to use dialog boxes to fill in parameters for PowerShell cmdlets.
- Delegation support: Administrative tasks can be delegated to users who do not have permissions for that type of task, without granting them perpetual additional permissions.
- Help update: Help documentations can be updated via Update-Help command.
- Automatic module detection: Modules are loaded implicitly whenever a command from that module is invoked. Code completion works for unloaded modules as well.
- New commands: Dozens of new modules were added, including functionality to manage disks
get-WmiObject win32_logicaldisk, volumes, firewalls, network connections, and printers, which had previously been performed via WMI.[further explanation needed]
Windows PowerShell 4.0
New features in PowerShell 4.0 include:
- Desired State Configuration:[83][84][85] Declarative language extensions and tools that enable the deployment and management of configuration data for systems using the DMTF management standards and WS-Management Protocol
- New default execution policy: On Windows Servers, the default execution policy is now
RemoteSigned. - Save-Help: Help can now be saved for modules that are installed on remote computers.
- Enhanced debugging: The debugger now supports debugging workflows, remote script execution and preserving debugging sessions across PowerShell session reconnections.
- -PipelineVariable switch: A new ubiquitous parameter to expose the current pipeline object as a variable for programming purposes
- Network diagnostics to manage physical and Hyper-V‘s virtualized network switches
- Where and ForEach method syntax provides an alternate method of filtering and iterating over objects.
Windows PowerShell 5.0

Key features included:
- The new
classkeyword that creates classes for object-oriented programming - The new
enumkeyword that creates enums OneGetcmdlets to support the Chocolatey package manager[87]- Extending support for switch management to layer 2 network switches.[88]
- Debugging for PowerShell background jobs and instances of PowerShell hosted in other processes (each of which is called a “runspace”)
- Desired State Configuration (DSC) Local Configuration Manager (LCM) version 2.0
- DSC partial configurations
- DSC Local Configuration Manager meta-configurations
- Authoring of DSC resources using PowerShell classes
Windows PowerShell 5.1
PowerShell Core 6
- The
-Parallelswitch for theForEach-Objectcmdlet to help handle parallel processing - Near parity with Windows PowerShell in terms of compatibility with built-in Windows modules
- A new error view
- The
Get-Errorcmdlet - Pipeline chaining operators (
&&and||) that allow conditional execution of the next cmdlet in the pipeline - The ?: operator for ternary operation
- The
??operator for null coalescing - The
??=operator for null coalescing assignment - Cross-platform
Invoke-DscResource(experimental) - Return of the
Out-GridViewcmdlet - Return of the
-ShowWindowswitch for theGet-Help
Comparison of cmdlets with similar commands
-
lsandmanaliases are absent in the Linux version of PowerShell Core. - Clear-Host is implemented as a predefined PowerShell function.
- Available in Windows NT 4, Windows 98 Resource Kit, Windows 2000 Support Tools
- Introduced in Windows XP Professional Edition
- Also used in UNIX to send a process any signal, the “Terminate” signal is merely the default
-
curlandwgetaliases are absent from PowerShell Core, so as to not interfere with invoking similarly named native commands.
| Extension | Description |
|---|---|
| .ps1 | Script file[111] |
| .psd1 | Module’s manifest file; usually comes with a script module or binary module[112] |
| .psm1 | Script module file[113] |
| .dll | DLL-compliant[a] binary module file[114] |
| .ps1xml | Format and type definitions file[49][115] |
| .xml | XML-compliant[b] serialized data file[116] |
| .psc1 | Console file[117] |
| .pssc | Session configuration file[118] |
| .psrc | Role Capability file[119] |
| Application | Version | Cmdlets | Provider | Management GUI |
|---|---|---|---|---|
| Exchange Server | 2007 | 402 | Yes | Yes |
| Windows Server | 2008 | Yes | Yes | No |
| Microsoft SQL Server | 2008 | Yes | Yes | No |
| Microsoft SharePoint | 2010 | Yes | Yes | No |
| System Center Configuration Manager | 2012 R2 | 400+ | Yes | No |
| System Center Operations Manager | 2007 | 74 | Yes | No |
| System Center Virtual Machine Manager | 2007 | Yes | Yes | Yes |
| System Center Data Protection Manager | 2007 | Yes | No | No |
| Windows Compute Cluster Server | 2007 | Yes | Yes | No |
| Microsoft Transporter Suite for Lotus Domino[120] | 08.02.0012 | 47 | No | No |
| Microsoft PowerTools for Open XML[121] | 1.0 | 33 | No | No |
| IBM WebSphere MQ[122] | 6.0.2.2 | 44 | No | No |
| IoT Core Add-ons[123] | 74 | Unknown | Unknown | |
| Quest Management Shell for Active Directory[124] | 1.7 | 95 | No | No |
| Special Operations Software Specops Command[125] | 1.0 | Yes | No | Yes |
| VMware vSphere PowerCLI[126] | 6.5 R1 | 500+ | Yes | Yes |
| Internet Information Services[127] | 7.0 | 54 | Yes | No |
| Windows 7 Troubleshooting Center[128] | 6.1 | Yes | No | Yes |
| Microsoft Deployment Toolkit[129] | 2010 | Yes | Yes | Yes |
| NetApp PowerShell Toolkit[130][131] | 4.2 | 2000+ | Yes | Yes |
| JAMS Scheduler – Job Access & Management System[132] | 5.0 | 52 | Yes | Yes |
| UIAutomation[133] | 0.8 | 432 | No | No |
| Dell Equallogic[134] | 3.5 | 55 | No | No |
| LOGINventory[135] | 5.8 | Yes | Yes | Yes |
| SePSX[136] | 0.4.1 | 39 | No | No |
![]()
Wikiversity has learning resources about PowerShell
- PowerShell on GitHub
- Windows PowerShell Survival Guide on TechNet Wiki
В этой статье мы рассмотрим, как обновить версию 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.


Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You’ll have a chance to have your questions answered in a live Ask Me Anything format.

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don’t miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Webinar from
Wednesday, 17 January 2024

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.
Watch The Replays

Webinar Replay from
Wednesday, 30 March 2022
At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Livestream from
Thursday, 9 June 2022
Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Livestream from
Thursday, 04 August 2022
Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We’ll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Livestreams from
October 2022

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You’ll have a chance to have your questions answered in a live Ask Me Anything format.

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don’t miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Webinar from
Wednesday, 17 January 2024

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.
Watch The Replays

Webinar Replay from
Wednesday, 30 March 2022
At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Livestream from
Thursday, 9 June 2022
Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Livestream from
Thursday, 04 August 2022
Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We’ll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Livestreams from
October 2022



