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

[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

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

安装 PowerShell |安装 PowerShell 的不同版本和步骤


[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

如何安装 PowerShell

以下文章提供了如何安装 PowerShell 的概述。 PowerShell 是 Microsoft 的任务自动化引擎,具有命令行 shell 和关联的脚本语言。 Windows PowerShell 是一个开源软件,其基本源代码可在 GitHub 上获取。它构建在 .NET 框架上,而 PowerShell Core 构建在 .NET Core 上。它可以帮助管理员和 IT 专业人员自动执行系统任务,配置和管理 Windows、Linux 和 macOS 等操作系统及其应用程序和进程。它在 Linux 中的等价物称为 Bash 脚本。它是一个面向对象的引擎,即它基于对象。 Windows PowerShell 的命令称为 cmdlet,它们是 .NET 类。它们执行一个操作,并作为输出返回一个对象,该对象可以通过管道作为另一个命令的输入。

PowerShell 函数被分组在一起用于管理称为 PowerShell 模块的特定任务。这些模块允许管理员重用脚本或代码来实现任务的自动化。 Windows PowerShell 的主机应用程序是集成脚本环境 (ISE)。它可以访问命令行工具、.NET 类库和 COM 对象。迄今为止,PowerShell 已经发布了许多版本。它于 2003 年 9 月在专业开发者大会上首次公开,名称为 Monad。 Windows PowerShell 的所有版本都与其以前的版本兼容。

不同版本的 PowerShell

不同版本的 PowerShell 如下:

1.PowerShell 1.0

它于 2006 年 11 月发布,受 Windows Server 2003 SP1、Windows XP SP2 和 Windows Vista 支持。

2.PowerShell 2.0

这些于 2009 年 10 月发布的产品与 Windows Server 2008 R2 和 Windows 7 集成。支持它的其他可用 Windows 版本包括 Windows XP Service Pack 3、带有 Service Pack 1 的 Windows Vista 和带有 Service Pack 2 的 Windows Server 2003。事务等其他功能、PowerShell 远程处理、可步进管道、模块、脚本调试、事件、Windows Powershell 集成脚本环境、块注释、新 cmdlet 和运算符。

3.PowerShell 3.0

它于 2012 年 9 月发布,与 Windows 8 和 Windows Server 2012 集成。它可用于带有 Service Pack 2 的 Windows Server 2008、带有 Service Pack 1 的 Windows 7 和带有 Service Pack 1 的 Windows Server 2008 R2。它是Windows Management Framework 3.0,于 2012 年 12 月向公众提供。添加了会话连接、计划作业和自动模块检测等新功能。

4.PowerShell 4.0

它于 2013 年 10 月发布,与 Windows 8.1 和 Windows Server 2012 R2 集成。 Windows 7 Service Pack 1、Windows Server 2012 和 Windows Server 2008 R2 Service Pack 1 也支持它。默认执行策略已设为 RemoteSigned,并且增强了调试功能。

5.PowerShell 5.0

它于 2016 年 2 月发布,与 Windows 10 集成,适用于 Windows 8.1、Windows 7 Service Pack 1、Windows Server 2012 R2 和 Windows Server 2012。其他功能,如 PowerShell .NET 枚举、PowerShell 后台作业调试、类包括定义、DSC 部分配置等。

6.PowerShell 5.1

该版本于 2017 年 1 月随 Windows 10 周年更新和 Windows Server 2016 一起发布。它是第一个包含桌面版和核心版两个版本的版本。

7.PowerShell核心6.0

它于 2018 年 1 月 10 日向公众发布,并于 2016 年 8 月 18 日宣布。许多 Windows 版本都支持它,例如 Windows 10、Windows 8.1、Windows 7 Service Pack 1、Windows Server 2012 R2、Windows Server 2012 和Windows 服务器 2016。

安装 PowerShell 的步骤

现在让我们看看如何在Windows 7上安装Windows PowerShell 3.0:

如果您使用的是 Windows 8、8.1、Windows Server 2012 或 Windows Server 2012 R2 等版本,则 Windows PowerShell 3.0 将预安装在您的系统中,但如果您使用的是 Windows 7 或 Windows Server 208 R2,则 Windows PowerShell 3.0 可能会预安装或者可能没有预安装。您可能使用的是 2.0 版,该版本预装在这些版本的 Windows 中。

您可以将版本从 2.0 更新到 3.0。但首先,您必须确保您正在使用哪个版本的 Windows Powershell。所以要检查版本。

第 1 步:单击“开始”,在搜索列中键入 PowerShell,然后选择 PowerShell 控制台。

[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

第 2 步: PowerShell 控制台将打开。然后输入命令:

获取- 主机 |选择对象版本

该命令的输出将告诉您版本。

[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

如果版本是3.0,那么你可以开始工作,但如果版本是2.0,那么你需要更新它。为此,您必须安装 Windows PowerShell 3.0。

步骤 3:您必须从 Microsoft 下载中心下载 Windows Management Framework 3.0,其中已包含 Windows PowerShell 3.0。 (https://www.microsoft.com/en-us/download/details.aspx?id=34595)

当您打开此 URL 时,将出现以下窗口;单击下载以下载 Windows Management Framework 3.0。

[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

第4步:选择所需的文件,然后单击“下一步”。

[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

第 5 步:文件将下载到您的系统上。打开它。

[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

第6步:它会询问您是否安装。单击“是”。

[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

第 7 步:将出现许可条款文档。选择“我接受”。

[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

安装将开始。

[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

第 8 步:它会要求重新启动系统。单击立即重新启动。

[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

正确安装后,您必须确保已将其配置为运行远程脚本;为此,请以管理员身份运行它。

第 9 步:点击“开始”->“所有程序”->“附件”->“Windows PowerShell”-> 右键单击“Windows PowerShell”->“以管理员身份运行”。

[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

第 10 步:之后,更改执行策略以允许运行远程脚本。

  • 类型:Set-ExecutionPolicy RemoteSigned -Force。

然后按 ENTER 键。

验证该执行策略。

  • 类型:获取执行策略。

[玩转系统] 安装 PowerShell |安装 PowerShell 的不同版本和步骤

如果输出是 RemoteSigned,则一切都已配置,您可以开始工作。

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

取消回复欢迎 发表评论:

关灯