当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 什么是 Windows PowerShell?升级的特点和好处

作者:精品下载站 日期:2024-12-14 19:06:00 浏览:14 分类:玩电脑

什么是 Windows PowerShell?升级的特点和好处


Windows 10 附带 Windows PowerShell 5.0;目前最新版本是PowerShell 7.0。 Windows 8.1 随 Windows PowerShell 4.0 一起安装。新版本包含许多新功能,旨在使其语言更简单、更易于使用并避免常见错误。如果您在 Windows 操作系统上使用早期版本的 PowerShell,迁移到此版本的 Windows PowerShell 将带来许多好处。它不仅可以让系统管理员管理 Windows Server 操作系统的各个方面,还可以控制基于 SQL、Exchange 和 Lync 的服务器。

什么是 PowerShell

PowerShell 是一种命令行 shell 和一种脚本语言。您可以使用 PowerShell 进行脚本自动化、批量运行命令、控制云中的资源等。现在有可在 Linux、macOS 和 Windows 操作系统上运行的 PowerShell Core。

如果您需要更多信息,可以查看 microsoft.com 上的PowerShell 简介,获取一些精彩的学习内容。

我正在运行哪个版本的 PowerShell

要了解您正在使用哪个版本的 PowerShell,请执行以下操作。

[玩转系统] 什么是 Windows PowerShell?升级的特点和好处

打开 PowerShell 窗口并输入以下命令中的任意一个并按 Enter 键:

get-host|Select-Object version

$psversiontable

$host.version

有关此内容的更多信息,请阅读 - 如何检查 Windows 10 中的 PowerShell 版本。

  • Windows Server 2012、Windows Server 2008 R2、Windows Server 2008 SP2、Windows 8 和 Windows 7 SP1 用户将能够使用Windows PowerShell 3.0

  • Windows Server 2012 R2、Windows Server 2012、Windows Server 2008 R2、Windows 8.1 和 Windows 7 SP1 用户将能够使用Windows PowerShell 4.0

  • Windows 10 附带 Windows PowerShell 5.0

Windows PowerShell 功能

Windows PowerShell 3.0 引入了以下新功能:

  • Windows PowerShell 工作流程

  • CIM cmdlet

  • 基于对象的 Cmdlet (CDXML)

  • Windows PowerShell Web 访问

  • 模块自动加载

  • 可更新的帮助

  • 稳健且断开连接的会话

  • 预定职位

Windows PowerShell 4.0带来了:

  • 期望状态配置 (DSC)

  • Windows PowerShell Web 访问改进

  • 工作流程增强

  • Windows PowerShell Web 服务的新功能

  • 保存-帮助

Windows 10 中包含的 Windows PowerShell 5.0 引入了以下功能:

  • 类可以在功能中定义

  • DSC 增强功能

  • 所有主机均提供转录

  • 调试的主要增强功能,包括调试 Windows PowerShell 作业的能力

  • 网络交换模块

  • OneGet 用于管理软件包

  • PowerShellGet 用于通过 OneGet 管理 Windows PowerShell 模块

  • 使用 COM 对象时的性能提升

Windows PowerShell 6.0 是跨平台(Windows、macOS 和 Linux)、开源的,专为异构环境和混合云而构建。

  • 从 .NET Framework 迁移到 .NET Core

  • 使用.NET Core 2.0作为其运行时。

  • 使 PowerShell Core 能够在多个平台(Windows、macOS 和 Linux)上运行。

  • .NET Core 和 .NET Framework 之间共享的 API 被定义为 .NET Standard 的一部分。

Windows PowerShell 7.0 附带了许多新功能,例如:

  • 管道并行化

  • 新运营商

  • ConciseView 和 Get-Error cmdlet

  • 自动新版本通知

  • 直接从 PowerShell 7 调用 DSC 资源

  • 兼容层。

  • 终端、PowerShell、命令提示符的区别解释

  • Windows PowerShell ISE 与 Windows PowerShell。

TechNet 库很好地详细解释了这些功能。让我们简单地看一下其中的一些。

Windows PowerShell 工作流:该功能将 Windows Workflow Foundation 的强大功能引入 Windows PowerShell。您可以使用 XAML 或 Windows PowerShell 语言编写工作流并像运行 cmdlet 一样运行它们。

对现有核心 Cmdlet 和提供程序的改进:Windows PowerShell 3.0 包含现有 cmdlet 的新功能,包括简化的语法以及 cmdlet 的新参数,例如 - Computer cmdlet、CSV cmdlet、Get-ChildItem、Get-Command 、获取内容、获取历史记录、测量对象、安全 cmdlet、选择对象、选择字符串、分割路径、启动过程、Tee 对象、测试连接和 .Add-Member

远程模块导入和发现:Windows PowerShell 3.0 扩展了远程计算机上的模块发现导入和隐式远程处理功能。

模块 cmdlet:能够使用 Windows PowerShell 远程处理将远程计算机上的模块导入到本地计算机。

新的 CIM 会话支持:通过将在远程计算机上隐式运行的命令导入本地计算机,授予使用 CIM 和 WMI 管理非 Windows 计算机的权限。

自动完成功能:节省打字时间,并减少打字错误。

PowerShell 3.0 Intellisense:用红色强调您所犯的错误,并在您将鼠标指针悬停在波浪线上时提出更正建议。

Update-Help cmdlet:这可以解决内置文档中的许多小错误或烦人的拼写错误。

增强的控制台主机体验:默认情况下,PowerShell 3.0 中启用 Windows PowerShell 控制台主机程序底层的更改。此外,文件资源管理器中新的“使用 PowerShell 运行”选项使您只需右键单击即可在不受限制的会话中运行脚本。

运行方式和共享主机支持:运行方式功能专为 Windows PowerShell 工作流而设计,允许会话配置的用户创建以共享用户帐户的权限运行的会话。另一方面,SharedHost 功能允许多台计算机上的多个用户同时连接到工作流会话并仔细跟踪工作流的进度。

特殊字符处理改进:快速了解 Windows PowerShell 3.0 表明,为了提高程序解释和正确处理特殊字符的能力,处理路径中特殊字符的 LiteralPath 参数几乎在所有具有 Path 参数的 cmdlet,包括新的 Update-Help 和 Save-Help cmdlet。

使用 PowerShell,您可以生成 Windows 服务列表、生成禁用功能列表、导出和备份设备驱动程序、查找系统正常运行时间、更新 Windows Defender 定义、列出驱动器、获取已安装驱动程序列表、卸载 Windows 应用商店应用程序、将项目添加到桌面上下文菜单、创建系统映像、下载文件等。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯