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.
- Windows 8.1 and Windows 10
- Windows Server 2012, Windows Server 2012 R2, Windows Server 2016, and Windows Server 2019
- macOS 10.13 or higher
- Red Hat Enterprise Linux (RHEL)
- CentOS 7
- Fedora 30 or higher
- Debian 9
- Ubuntu LTS 16.04 or higher
- 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
- Default
GA, Preview and RC releases - Off
Turns off the update notification feature - 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
- Pipeline parallelization with ForEach-Object-Parallel
- New operators
- Ternary operator, for example: a ? b : c
- Pipeline chain operators, like || and &&
- Null conditional operators, like ?? and ??=
- A simplified and dynamic error view and Get-Error cmdlet for easier investigation of errors
- A compatibility layer that enables users to import modules in an implicit Windows PowerShell session
- Automatic new version notifications
- The ability to invoke DSC resources directly from PowerShell 7 experimental
Reference:
What is New in PowerShell 7.0