Knowing PowerShell 7.0 and its new features

Table of Contents
Knowing PowerShell 7.0 and its new features

What is PowerShell ?

PowerShell is an open-source and cross-platform program that can be found on Windows, MacOS, or Linux. PowerShell was built to manage heterogeneous environments and hybrid clouds.


Where We Can Install PowerShell ?

PowerShell 7 currently supports some operating systems, especially on x64. Below is a list of operation systems supported by PowerShell 7.0.

  1. Windows 8.1 and Windows 10
  2. Windows Server 2012, Windows Server 2012 R2, Windows Server 2016, and Windows Server 2019
  3. macOS 10.13 or higher
  4. Red Hat Enterprise Linux (RHEL)
  5. CentOS 7
  6. Fedora 30 or higher
  7. Debian 9
  8. Ubuntu LTS 16.04 or higher
  9. Alpine Linux 3.8 or higher
Note: PowerShell 7.0 supports ARM32 and ARM64 of Debian, Ubuntu, and ARM64 Alpine Linux.

How To Run PowerShell 7.0 On Windows

PowerShell 7 installs to a new directory. If you have installed PowerShell Core 6 before, the PowerShell 7.0 will remove and upgrade your PowerShell Core 6. But if you just have PowerShell 5.1, that will run side-by-side with PowerShell 7.

On Windows PowerShell 7 is installed to directory below

%programfiles%\PowerShell\7

The %programfiles%\PowerShell\7 folder is added to $env:PATH The PowerShell 7 installed packages.

Below is the detail of the directory installed upgrade or replace PowerShell 6 with PowerShell 7

PowerShell Core 6.x on Windows:

%programfiles%\PowerShell\6
Change to
%programfiles%\PowerShell\7

Linux:
/opt/microsoft/powershell/6
Change to
/opt/microsoft/powershell/7

macOS:
/usr/local/microsoft/powershell/6
Change to
/usr/local/microsoft/powershell/7


How To Run PowerShell On Windows

Windows PowerShell launch by name powershell.exe. In PowerShell version 6 or higher, the executable is changed to support side-by-side execution.

The new executable to launch PowerShell 7 is type pwsh.exe on search bar.

.

How If We Don't Want To Update Our PowerShell

At PowerShell 7, the system will check for updates once a day and automatically notify about a new version if it is available. The information is shown only at the start of subsequent sessions.

There are three flags available for PowerShell Update

  1. Default
    GA, Preview and RC releases
  2. Off
    Turns off the update notification feature
  3. LTS
    Only notifies of updates to long-term-servicing (LTS) GA releases

If you want to turn off update notifications in PowerShell 7, you can try to execute this command in the PowerShell window.

$Env:POWERSHELL_UPDATECHECK = 'Off'

Anything about the features of PowerShell 7.0

Some additional features that can be found on PowerShell 7.0 are

  1. Pipeline parallelization with ForEach-Object-Parallel
  2. New operators
  3. Ternary operator, for example: a ? b : c
  4. Pipeline chain operators, like || and &&
  5. Null conditional operators, like ?? and ??=
  6. A simplified and dynamic error view and Get-Error cmdlet for easier investigation of errors
  7. A compatibility layer that enables users to import modules in an implicit Windows PowerShell session
  8. Automatic new version notifications
  9. The ability to invoke DSC resources directly from PowerShell 7 experimental

Reference:
What is New in PowerShell 7.0