跨平台自动化工具和配置框架 PowerShell 7.2.1 稳定版现已全面上市。适用于 Windows、macOS和GNU/Linux平台,在新版本中微软已经从.NET Core 2.x迁移到3.1,得益于诸多.NET Framework API的复活,能实现比现有 Windows PowerShell 模块更大的向后兼容性。
PowerShell 是构建于 .NET 上基于任务的命令行 shell 和脚本语言。 PowerShell 可帮助系统管理员和高级用户快速自动执行用于管理操作系统(Linux、macOS 和 Windows)和流程的任务。使用 PowerShell 命令可以从命令行管理计算机。 PowerShell 提供程序可让你访问数据存储(如注册表和证书存储),与你访问文件系统一样方便。 PowerShell 具有丰富的表达式分析器和完全开发的脚本语言。
PowerShell 7的跨平台性质意味着Ubuntu,openSUSE,Fedora,Debian和其他Linux发行版均能够使用。产品项目经理Joey Aiello表示:“如果过去由于模块兼容性问题而无法使用PowerShell Core 6.x, 那么这会是你能充分利用卓越功能的新版本,今天正式和大家见面了。”
完整的支持操作系统包括64位版本的 Windows 7/8.1/Windows 10,Windows 11,以及 Windows Server 2019/2012/2012 R2/Windows Server 2016 和 2008,macOS 10.13及更高版本,Red Hat Enterprise Linux (RHEL) / CentOS 7及更高版本,Fedora 29及更高版本,Debian 9及更高版本, Ubuntu 16.04及更高版本, openSUSE 15及更高版本和Alpine Linux 3.8及更高版本。
Debian和Ubuntu也支持ARM32和ARM64版本,ARM64 Alpine Linux也受支持。微软表示,虽然没有官方的支持,但是有社区生产的软件包可用于Arch和Kali Linux。
Aiello重点介绍了可以在PowerShell 7中找到的一些新功能:
● 使用ForEach-Object -Parallel进行管道并行化
● 新的运行符
⊙ 三元: a ? b : c
⊙ 管道链运营符号:|| 和 &&
⊙ 空条件运算符:?? 和 ??=
● 简化的动态错误视图和Get-Error cmdlet,可更轻松地调查错误
● 兼容性层,使用户能够在隐式Windows PowerShell会话中导入模块
● 自动新版本通知
● 直接从PowerShell 7调用以调用DSC资源的能力(实验性)
PowerShell Core 现在是 GitHub 上的开放源代码项目。 若要详细了解如何在各种受支持的试验平台上安装 PowerShell Core,请参阅以下文章。
- 在 Windows 上安装 PowerShell Core
- 在 Linux 上安装 PowerShell Core
- 在 macOS 上安装 PowerShell Core
- 在 ARM 上安装 PowerShell Core
7.2.0
General Cmdlet Updates and Fixes
Handle exception when trying to resolve a possible link path (#16310)
Tests
Fix global tool and SDK tests in release pipeline (#16342)
下载地址:
https://github.com/powershell/powershell
https://github.com/PowerShell/PowerShell/releases
Windows PowerShell v7.2.1 稳定版
for Windows:
https://github.com/PowerShell/PowerShell/releases/download/v7.2.1/PowerShell-7.2.1-win-x64.msi
https://github.com/PowerShell/PowerShell/releases/download/v7.2.1/PowerShell-7.2.1-win-x86.msi
for MacOS:
https://github.com/PowerShell/PowerShell/releases/download/v7.2.1/powershell-7.2.1-osx-x64.pkg
for Linux:
https://github.com/PowerShell/PowerShell/releases/download/v7.2.1/powershell-7.2.1-linux-x64.tar.gz