Getting Versioning Clarity
PowerShell and Windows PowerShell are separately installed and you can run supported commands using either environment.
There are two versions of Powershell:
Windows PowerShell - Windows PowerShell is available exclusively for the Windows OS. All versions of Windows PowerShell up to and including 5.1, which is the version available with Windows 10, are integrated with a Windows OS.
PowerShell - PowerShell is shipped, installed, and configured separately from Windows PowerShell. First released as PowerShell Core 6.0 in 2018, it was the first version that offered multi-platform support, extending its availability to macOS and Linux operating systems. However, PowerShell 7 is the defacto for cross-platform scripting in PowerShell with v6 retired.
Installation differences in PowerShell Versions
Installing the latest version of PowerShell results in the following when compared to Windows PowerShell:
Separate installation path and executable name.
Windows PowerShell 5.1 is installed in the $env:WINDIR\System32\WindowsPowerShell\v1.0 location.
PowerShell 7 is installed in the $env:ProgramFiles\PowerShell\7 location. The new location is added to your PATH, which allows you to run both Windows PowerShell 5.1 and PowerShell 7.
In Windows PowerShell, the PowerShell executable is named powershell.exe.
In version 6 and newer, the executable is named pwsh.exe. The new name makes it easy to support side-by-side execution of both versions.
Separate PSModulePath. By default, Windows PowerShell and PowerShell 7 store modules in different locations. PowerShell 7 combines those locations in the $Env:PSModulePath environment variable.
When you import a module by name, PowerShell checks the location that $Env:PSModulePath specifies. This feature allows PowerShell 7 to load both Core and Desktop modules.
Separate profiles for each version. A PowerShell profile is a script that runs when PowerShell starts. This script customizes the PowerShell environment by adding commands, aliases, functions, variables, modules, and PowerShell drives.
In Windows PowerShell 5.1, the profile's location is $HOME\Documents\WindowsPowerShell.
In PowerShell 7, the profile's location is $HOME\Documents\PowerShell.
Separate event logs. Windows PowerShell and PowerShell 7 log events to separate Windows event logs (if using a Windows Server or PC).
When you're reviewing a PowerShell session, it's important to determine which version you're using. To determine the current version, enter $PSVersionTable in the PowerShell console, and then select Enter. PowerShell displays the version numbers for various components, including the main PowerShell version number.
PowerShell and Bit-ness
On 64-bit operating systems, the PowerShell host applications are available in both 64-bit (x64) and 32-bit (x86) versions.
On 32-bit operating systems, PowerShell’s host applications are available only in 32-bit versions. When working with Windows PowerShell, you'll notice that the icons and window title bars don't have the (x86) designation. Instead, they display simply as Windows PowerShell and Windows PowerShell ISE in the Start menu.
If you intend to use PowerShell to perform administrative tasks on computers that have User Account Control (UAC) enabled, you might have to take an extra step to run PowerShell cmdlets with full administrative credentials. To do this, right-click or activate the context menu for the application icon, and then select Run as Administrator. When you're running PowerShell with administrative credentials, the host application’s window title bar will include the Administrator prefix
No comments:
Post a Comment