[图]微软解释为何PowerShell直接从6.2升至7.0的原因

上月,微软宣布将为PowerShell提供全平台升级。** 本次升级直接将版本号从6.2升至7.0,为此在今天发布的官方博文中微软解释了这么做的原因。**就在昨天,微软发布了 PowerShell 7 的首个预览版,按照其更新节奏,每个月它都会推出新的预览版,直到 GA 版发布。

微软在博文中写道啊:

PowerShell Core使用率在过去两年中显着增长。需要特别指出的是,我们的大部分增长来自Linux使用,这是一个令人鼓舞的统计数据,表明我们的投资让PowerShell不断跨平台使用......

但是,我们也可以清楚地看到,PowerShell在Windows使用量并没有显着增长,令人惊讶的是PowerShell在Windows非常普遍......

这意味着Windows PowerShell和PowerShell Core用户能够在Windows,Linux和macOS以及Windows上自动执行使用相同版本的PowerShell,而现在PowerShell 7用户将与他们所依赖的Windows PowerShell模块具有非常高的兼容性。

换句话说,微软希望所有平台处于同一个PowerShell版本中,从而实现更好的跨平台兼容性。此外微软还对PowerShell的支持生命周期进行了更改。微软宣布将紧随.NET Core支持周期,将发布LTS(长期服务)和非LTS版本的PowerShell 7。微软还将会面向Windows用户发布PowerShell 7,但是会允许用户在PowerShell 5.1和PowerShell 7之间切换。

PowerShell 7 Preview已经于今天发布,微软希望以1个月为更新周期发布新的预览版。

v7.0.0-preview.4 - 09/19/2019 Engine Updates and Fixes Add support to ActionPreference.Break to break into debugger when Debug, Error, Information, Progress, Verbose or Warning messages are generated (#8205) (Thanks @KirkMunro!) Enable starting control panel add-ins within PowerShell Core without specifying .CPL extension. (#9828) Performance Make ForEach-Object faster for its commonly used scenarios (#10454) and fix ForEach-Object -Parallel performance problem with many runspaces (#10455) Experimental Features Update PSDesiredStateConfiguration module version to 2.0.3 and bring new tests; enable compilation to MOF on non-Windows and use of Invoke-DSCResource without LCM (#10516) Add APIs for breakpoint management in runspaces and enable attach to process without BreakAll for PowerShell Editor Services (#10338) (Thanks @KirkMunro!) Support ternary operator in PowerShell language (#10367) General Cmdlet Updates and Fixes Add PowerShell Core group policy definitions (#10468) Update console host to support XTPUSHSGR/XTPOPSGR VT control sequences that are used in composability scenarios. (#10208) Add WorkingDirectory parameter to Start-Job (#10324) (Thanks @davinci26!) Remove the event handler that was causing breakpoint changes to be erroneously replicated to the host runspace debugger (#10503) (Thanks @KirkMunro!) Replace api-ms-win-core-job-12-1-0.dll with Kernell32.dll in Microsoft.PowerShell.Commands.NativeMethods P/Invoke API(#10417) (Thanks @iSazonov!) Fix wrong output for New-Service in variable assignment and -OutVariable (#10444) (Thanks @kvprasoon!) Fix global tool issues around exit code, command line parameters and path with spaces (#10461) Fix recursion into OneDrive - change FindFirstFileEx() to use SafeFindHandle type (#10405) Skip auto-loading PSReadLine on Windows if the NVDA screen reader is active (#10385) Increase built-with-PowerShell module versions to 7.0.0.0 (#10356) Add throwing an error in Add-Type if a type with the same name already exists (#9609) (Thanks @iSazonov!)
Windows PowerShell 6: Essentials for Administration (IT Pro Solutions) by William Stanek English | 6 Apr. 2017 | ASIN: B06VWVJYB2 | 302 Pages | AZW3 | 647.68 KB Covers all release versions of PowerShell for all current versions of the Windows Server and Windows operating systems. Practical and precise, this hands-on guide with ready answers is designed for IT professionals working with Microsoft products, whether for on-premises, hybrid or cloud support. Inside, you'll find expert insights, tips, tricks and workarounds that will show you how to make the most of Windows PowerShell in the shortest amount of time possible. During the course of reading this book, you will master a number of complex topics, techniques, commands and functions. This book focuses on administration tasks, including: Using PowerShell to manage Windows roles and features Inventorying and evaluating computers using scripting Working with PowerShell drives, directories and files Reading and writing file contents Getting and setting security descriptors Creating access rules and taking ownership Configuring file and directory auditing Navigating the Windows Registry Creating and managing registry keys Comparing registry keys Viewing and filtering event logs Setting event log options Writing custom events Managing the state of system services Configuring service options, such as logon and recovery Joining computers to a domain Renaming computers Restarting or shutting down computers remotely Enabling or disabling system restore Creating and using checkpoints Recovering from restore points Examining running processes Analyzing computer performance Monitoring resource usage Windows PowerShell 6: Essentials for Administration can be used with the companion book, Windows PowerShell 6: IT Pro Solutions. About the Authors William Stanek Sr. was Microsoft Press's top technical author for nearly 20 years, and is widely recognized as a leading authority in Microsoft technologies. His more than 150 published works have been read by over 10 million people, translated into 34 languages, and are available in more than 70 countries. An avid outdoorsman, William enjoys hiking, spelunking, and trekking in search of adventure. So if he’s not writing or lecturing, William’s probably out enjoying the great outdoors or at the least, a backyard barbeque. William Stanek Jr. began his tech career as an intern at Stanek & Associates in 2007 and is currently working as a development and engineering lead for the company. While most high schoolers were out enjoying spring break and summer vacations, Will worked as an assistant on the publishing side of the business, before moving over to the technical side of the business during his college years at University of Washington. As a technologist, Will provided support, technical review, and made other contributions to a myriad of books written by William R. Stanek Sr. between 2010 and 2015. Since 2015 Will’s direct written contributions to over a dozen books earned him cover credits as a contributor. Will is co-author of Windows PowerShell: Essentials, IIS 10: Essentials and several other forthcoming books.
### PowerShell 6.2 下载与安装指南 PowerShell 6.2 是一个较旧的版本,但仍然可以在某些特定场景下使用。官方已停止对 PowerShell 6.x 系列的支持,建议尽可能使用最新的 PowerShell 7.x 版本[^1]。然而,如果确实需要下载和安装 PowerShell 6.2,可以参考以下方法: #### 官方下载地址 PowerShell 6.2 的官方下载页面可以通过访问 Microsoft GitHub 存储库获取。具体链接如下: - **GitHub 发布页面**: [https://github.com/PowerShell/PowerShell/releases/tag/v6.2.0](https://github.com/PowerShell/PowerShell/releases/tag/v6.2.0)[^3] 在该页面中,可以选择适合操作系统的安装包进行下载。例如: - Windows 用户可以选择 `.msi` 或 `.exe` 文件。 - Linux 和 macOS 用户可以选择对应的二进制文件或包管理器方式安装。 #### 安装步骤 以下是适用于 Windows 系统的安装指南: 1. 下载完成后,运行 `.msi` 或 `.exe` 文件。 2. 按照安装向导提示完成安装。 3. 安装完成后,可以通过以下命令验证版本是否正确: ```powershell $PSVersionTable.PSVersion ``` 如果输出为 `6.2.0`,则说明安装成功[^1]。 #### 注意事项 - PowerShell 6.2 不支持所有 Windows 平台,支持 Windows 7 SP1 及更高版本。 - 如果系统中已经安装了 Windows PowerShell 5.1,PowerShell 6.2 将会并行安装到不同的目录中[^1]。 - 建议在安装前查看官方文档以确保兼容性:[PowerShell 安装指南](https://docs.microsoft.com/powershell/scripting/install/installing-powershell-core-on-windows)[^4]。 ```powershell # 示例:检查当前系统上安装的所有 PowerShell 版本 Get-Command powershell.exe, pwsh.exe -ErrorAction SilentlyContinue | Select-Object Name, Version, Source ``` ### 相关脚本示例 以下是一个简单的 PowerShell 脚本,用于列出当前系统中的所有 PowerShell 版本: ```powershell # 列出所有可用的 PowerShell 版本 $versions = @() foreach ($exe in @("powershell.exe", "pwsh.exe")) { if (Get-Command $exe -ErrorAction SilentlyContinue) { $version = & $exe -NoProfile -Command "$PSVersionTable.PSVersion" $versions += "$exe: $version" } } $versions ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值