banner



How To Upgrade Powershell On Windows 10

PowerShell vii, currently available in version 7.1, is the almost recent release of Microsoft's cantankerous-platform scripting language. Today, we will accept a look at how to install and upgrade to PowerShell 7.1.

  • Writer
  • Recent Posts

For many years, PowerShell was a Windows-only scripting language. However, this changed a couple of years ago with PowerShell Cadre 6. Microsoft has continued this cross-platform trend, and the latest release of PowerShell vii.1 is no dissimilar. Information technology is built on .NET Core 3.i and is supported on multiple platforms. More than detailed information can be constitute on the PowerShell Support Lifecycle page.

PowerShell 7.1 supported platforms

PowerShell 7.1 supported platforms

PowerShell is now an open up-source projection located on GitHub. In this postal service, I will focus on how to install PowerShell 7.one in a Windows-based environment. To install PowerShell 7.1 on different platforms, use the official Microsoft documentation for Linux, MacOS, and ARM.

Prerequisites ^

The only prerequisites mentioned in the documentation are related to PowerShell 7.ane remoting over WSMan. To employ remoting over WSMan, the following prerequisites need to be met:

  • Universal C runtime—Already included in Windows 10 and Windows Server 2016/2019
  • Windows Management Framework (WMF) 4.0 or newer—Required on Windows 7 or Windows Server 2008 R2

Note there is a little inconsistency in Microsoft's documentation. Whereas the PowerShell Support Lifecycle folio says that Windows 7 and Windows Server 2008 R2 are not supported, the Installing PowerShell on Windows folio says that PowerShell 7.1 is supported on those systems.

Documentation inconsistency about supported Windows systems

Documentation inconsistency about supported Windows systems

PowerShell seven.1 and earlier PowerShell versions ^

PowerShell vii was designed to coexist with Windows PowerShell 5.1. PowerShell 7 installs to a new directory, enabling side-by-side execution.

PowerShell install locations can exist found in the PATH variable:

  • Windows PowerShell 5.ane: $env:WINDIR\System32\WindowsPowerShell\v1.0
  • PowerShell Core 6.x: $env:ProgramFiles\PowerShell\6
  • PowerShell 7: $env:ProgramFiles\PowerShell\seven

The versions also accept different executable names:

  • powershell.exe for Windows PowerShell 5.1
  • pwsh.exe for PowerShell 7/7.one

For more information, read PowerShell v5 vs. PowerShell v7—Which to apply and when, written past my colleague, Timothy Warner, here on 4sysops.com.

Migration from PowerShell Cadre 6.x to PowerShell 7 is an in-place upgrade. PowerShell Cadre 6.x is replaced and its install location removed from the PATH variable.

Manual MSI bundle installation ^

To install PowerShell using the MSI parcel, simply download information technology from GitHub and follow the setup prompts. The installer comes with several options, such as Enable PowerShell remoting.

MSI package installation options

MSI parcel installation options

I mention Enable PowerShell remoting considering in PowerShell 7.1, remoting over WSMan requires a unlike WinRM endpoint than Windows PowerShell 5.i. Likewise, the Enter-PSSession command needs to have a –ConfigurationName parameter specified; otherwise, the Windows PowerShell 5.1 remoting endpoint will be used.

Enter-PSSession -ComputerName dc -ConfigurationName "powershell.vii.1.0"        

However, be aware that this checkbox does non work and the installer will non perform the required actions. To enable remoting, you have to run script Install-PowerShellRemoting.ps1 located in the $PSHome folder. The picture show below shows an endeavor to access the server remotely after the MSI parcel installation and after the script execution.

MSI installer does not enable PowerShell 7.1 remoting

MSI installer does not enable PowerShell seven.one remoting

Boosted data about what the script does can exist found in this commodity. It'south a bit light-headed that Microsoft says "the installation script is a short-term solution, until we add together the functionality to Enable-PSRemoting" in an article released in the center of 2018, isn't it?

Control line MSI package installation ^

As usual, MSI packages tin also be installed via the command line, allowing unattended installation. To silently install PowerShell 7.1, utilise the command below.

msiexec.exe /package "c:\Temp\PowerShell-7.1.0-win-x64.msi" /placidity ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=ane ENABLE_PSREMOTING=ane REGISTER_MANIFEST=one        

Interestingly, using control line installation will likewise flawlessly enable PowerShell 7.1 remoting, unlike the graphical MSI installer. You can also install PowerShell seven.1 remotely via the PSExec tool. Equally you tin see in the flick, PowerShell seven.1 remoting works fine immediately following the execution.

.\PsExec.exe \\srv msiexec.exe /package "c:\Temp\PowerShell-7.i.0-win-x64.msi" /repose ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=one ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1        

Install PowerShell 7.1 via PSExec

Install PowerShell seven.1 via PSExec

Alternatively, the installation can too exist performed remotely using Windows PowerShell 5.1 remoting.

Invoke-Command -ComputerName srv -ScriptBlock {Beginning-Process msiexec.exe -ArgumentList '/parcel "c:\Temp\PowerShell-vii.one.0-win-x64.msi" /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=one ENABLE_PSREMOTING=1 REGISTER_MANIFEST=ane' -Look}        

Exist aware this method can be a bit catchy. It ends with an fault, even if the installation was successful. The reason for the mistake is very unproblematic. Y'all are using remoting over WSMan, and since the installer is calculation a new WSMan endpoint and restarts the WinRM service afterwards that, your remoting session is terminated.

Error during PowerShell 7.1 installation over Windows PowerShell remoting session

Fault during PowerShell 7.i installation over Windows PowerShell remoting session

Notice that despite the mistake, I was able to connect to PowerShell 7 remoting right away, which means PowerShell seven.i was installed successfully and its WSMan endpoint was created correctly.

New registry keys ^

Since PowerShell seven.1, the installer has created new registry keys that shop the installation location and version. This may be used past administrators or developers to find out where PowerShell is located, equally the installation path is no longer stock-still. The GUID value is unique for each build blazon, major version, and compages.

Registry keys store installation location and version

Registry keys store installation location and version

ZIP package installation ^

PowerShell 7.one can as well be deployed using ZIP packages. After downloading the package from GitHub, merely extract it to any location and run pwsh.exe. This method can be useful if you need to run PowerShell seven.one side-by-side with other versions, such as PowerShell Core 6.x.

Note that deploying PowerShell from the Nix package will not check the prerequisites needed for remoting over WSMan, it will not create registry keys with the installation location, and the WSMan remoting endpoint is not created.

One-liner script to install/update PowerShell 7.1 ^

Steve Lee from the Microsoft PowerShell team created a one-liner script to install and update PowerShell on Windows 10. From an elevated PowerShell session, run the following command:

Invoke-Expression "& { $(Invoke-RestMethod 'https://aka.ms/install-powershell.ps1') } –useMSI -EnablePSRemoting -Quiet"        

There is besides a script available to install PowerShell vii.1 on Linux.

wget https://aka.ms/install-powershell.sh; sudo bash install-powershell.sh; rm install-powershell.sh        

Both scripts have several switches available, and their descriptions can be plant direct in the scripts.

Subscribe to 4sysops newsletter!

Final words ^

In this post, we have taken a look at various ways to install PowerShell 7.ane in a Windows-based surround and how to enable and use PowerShell 7.1 remoting over WSMan. Don't get confused with the naming—Windows PowerShell goes with version five.one, and PowerShell goes with version 7.1. Further details can be found in the official documentation.

avatar

Source: https://4sysops.com/archives/how-to-install-and-upgrade-to-powershell-71/

Posted by: craytonshose1997.blogspot.com

0 Response to "How To Upgrade Powershell On Windows 10"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel