How to upgrade PowerShell

Source: Internet
Author: User

background:

The PowerShell script developed requires the use of the Invoke-restmethod command, which found that the command was not supported on the old server and was queried for problems with the PS version. Involves the upgrade of PS, need to introduce the next PowerShell version.

An error occurred as follows:

Introduction:

PowerShell is a command-line scripting environment that runs on Windows machines to implement system and application management automation. PowerShell needs. NET environment, while supporting it. NET object. There are four versions of the current PowerShell, 1.0,2.0,3.0, 4.0, respectively .

If the system is WINDOW7 or Windows Server 2008, PowerShell 2.0 is already built-in and can be upgraded to 3.0, 4.0.

If the system is Windows 8 or Windows Server 2012, PowerShell 3.0 is already built-in and can be upgraded to 4.0.

If the system is Windows 8.1 or Windows Server R2, the default is 4.0.

 

It happened that I encountered a use of the PS script place need to use 3.0 and above, Microsoft This version of the upgrade is very good only in a few steps to achieve the upgrade, and achieve forward compatibility (unfortunately, the 32-bit version can only be backwards compatible). The following is a description of the upgrade steps for 2.0 Upgrade 3.0:

Windows 7 and Windows Server R2 kernel versions are the same as 6.1, the following steps explain how to install Windows Powersh on a machine running Windows 7 SP1 and Windows Server R2 SP1 Ell 3.0.

Installation Preparation


1. Before you install Windows Management Framework 3.0, uninstall any versions prior to Windows Management Framework 3.0.

To uninstall earlier versions of Windows PowerShell 3.0, complete the following procedure on each computer that has an earlier version installed:

In the Windows Control Panel, click Uninstall a program.
In programs and features, click View Installed updates.
In the Uninstall Updates pane, in the Microsoft Windows section, locate the update titled Microsoft Windows Management Framework 3.0 Beta (KB2506143).
Right-click Microsoft Windows Management Framework 3.0 Beta (KB2506143), and then click Uninstall.
In the Uninstall Updates dialog box, click Yes.

Note that you need to restart the computer after uninstalling the update.

Install Windows PowerShell 3.0


1. Install the full installation version of Microsoft. NET Framework 4.0 (Dotnetfx40_full_x86_x64.exe), or install the Microsoft. NET Framework 4.5 of the Full installation version (Dotnetfx45_full_x86_x64.exe).

2. Install the 6.1 kernel version installation file (windows6.1-kb2506143-x64.msu) for Windows Management Framework 3.0.

Complete the installation of the following procedure:

Double-click the file "Windows6.1-kb2506143-x64.msu".
In the Windows Update Standalone Installer dialog box, click Yes when you are asked if you want to install the update.
In the Download and Install Updates Wizard, on the please read the License Terms page, click I accept.
On the Installation Complete page, click Restart now to restart the computer immediately. (You must restart your computer for the update to take effect.) If you do not want to restart your computer immediately, click Close. As mentioned earlier, the Windows

You still need to restart your computer before PowerShell 3.0 is fully installed.

3. Verify that Windows PowerShell 3.0 is installed successfully.

After the computer restarts, you can perform the following checks to verify that Windows PowerShell 3.0 is installed:

Click Start, All Programs, accessories, and Windows PowerShell, and then click Windows PowerShell.
In the Windows PowerShell console, type the following command at a command prompt, and then press ENTER:

Get-host | Select-object Version

If Windows PowerShell 3.0 is installed, you will see the output as follows:

Version
-------
3.0

Attention

If the server itself already has a higher version of the Windows Management Framework, such as 4.5, then you do not need to delete anything and install WINDOWS6.1-KB2506143-X64.MSU directly. Reboot required.

Summarize:

This article is mainly about how to upgrade PowerShell in Windows 2008 or 7, and happens to have a problem, so this scenario is recorded, because many servers are now 2008r2, for future operations and upgrades to provide the basis for reference.

How to upgrade PowerShell

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.