diff --git a/reference/5.1/Microsoft.PowerShell.Utility/Select-Object.md b/reference/5.1/Microsoft.PowerShell.Utility/Select-Object.md index bfe059efc0f3..513142303a3b 100644 --- a/reference/5.1/Microsoft.PowerShell.Utility/Select-Object.md +++ b/reference/5.1/Microsoft.PowerShell.Utility/Select-Object.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 09/25/2020 +ms.date: 10/15/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/select-object?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: Select-Object @@ -141,7 +141,24 @@ b c ``` -### Example 5: Select newest and oldest events in the event log +### Example 5: Using `-Unique` with other parameters + +The **Unique** parameter filters values after other `Select-Object` parameters are applied. For +example, if you use the **First** parameter to select the first number of items in an array, **Unique** +is only applied to the selected values and not the entire array. + +```powershell +"a","a","b","c" | Select-Object -First 2 -Unique +``` + +```Output +a +``` + +In this example, **First** selects `"a","a"` as the first 2 items in the array. **Unique** is +applied to `"a","a"` and returns `a` as the unique value. + +### Example 6: Select newest and oldest events in the event log This example gets the first (newest) and last (oldest) events in the Windows PowerShell event log. @@ -155,7 +172,7 @@ $a = Get-EventLog -LogName "Windows PowerShell" $a | Select-Object -Index 0, ($A.count - 1) ``` -### Example 6: Select all but the first object +### Example 7: Select all but the first object This example creates a new PSSession on each of the computers listed in the Servers.txt files, except for the first one. @@ -167,7 +184,7 @@ of computers is set as the value of the **ComputerName** parameter of the `New-P New-PSSession -ComputerName (Get-Content Servers.txt | Select-Object -Skip 1) ``` -### Example 7: Rename files and select several to review +### Example 8: Rename files and select several to review This example adds a "-ro" suffix to the base names of text files that have the read-only attribute and then displays the first five files so the user can see a sample of the effect. @@ -187,7 +204,7 @@ Get-ChildItem *.txt -ReadOnly | Select-Object -First 5 -Wait ``` -### Example 8: Demonstrate the intricacies of the -ExpandProperty parameter +### Example 9: Demonstrate the intricacies of the -ExpandProperty parameter This example demonstrates the intricacies of the **ExpandProperty** parameter. @@ -245,7 +262,7 @@ ToUInt64 Method uint64 IConvertible.ToUInt64(System.IFormatProvider pro Name NoteProperty string Name=CustomObject ``` -### Example 9: Create custom properties on objects +### Example 10: Create custom properties on objects The following example demonstrates using `Select-Object` to add a custom property to any object. When you specify a property name that does not exist, `Select-Object` creates that property as a @@ -263,7 +280,7 @@ MyCustomProperty New Custom Property ``` -### Example 10: Create calculated properties for each InputObject +### Example 11: Create calculated properties for each InputObject This example demonstrates using `Select-Object` to add calculated properties to your input. Passing a **ScriptBlock** to the **Property** parameter causes `Select-Object` to evaluate the expression on @@ -505,6 +522,8 @@ Accept wildcard characters: False Specifies that if a subset of the input objects has identical properties and values, only a single member of the subset will be selected. +**Unique** selects values _after_ other filtering parameters are applied. + This parameter is case-sensitive. As a result, strings that differ only in character casing are considered to be unique. diff --git a/reference/7.0/Microsoft.PowerShell.Utility/Select-Object.md b/reference/7.0/Microsoft.PowerShell.Utility/Select-Object.md index ba3606135db3..7c20f33f24cd 100644 --- a/reference/7.0/Microsoft.PowerShell.Utility/Select-Object.md +++ b/reference/7.0/Microsoft.PowerShell.Utility/Select-Object.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 09/25/2020 +ms.date: 10/15/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/select-object?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 title: Select-Object @@ -147,7 +147,24 @@ b c ``` -### Example 5: Select newest and oldest events in the event log +### Example 5: Using `-Unique` with other parameters + +The **Unique** parameter filters values after other `Select-Object` parameters are applied. For +example, if you use the **First** parameter to select the first number of items in an array, **Unique** +is only applied to the selected values and not the entire array. + +```powershell +"a","a","b","c" | Select-Object -First 2 -Unique +``` + +```Output +a +``` + +In this example, **First** selects `"a","a"` as the first 2 items in the array. **Unique** is +applied to `"a","a"` and returns `a` as the unique value. + +### Example 6: Select newest and oldest events in the event log This example gets the first (newest) and last (oldest) events in the Windows PowerShell event log. @@ -161,7 +178,7 @@ $a = Get-EventLog -LogName "Windows PowerShell" $a | Select-Object -Index 0, ($A.count - 1) ``` -### Example 6: Select all but the first object +### Example 7: Select all but the first object This example creates a new PSSession on each of the computers listed in the Servers.txt files, except for the first one. @@ -173,7 +190,7 @@ of computers is set as the value of the **ComputerName** parameter of the `New-P New-PSSession -ComputerName (Get-Content Servers.txt | Select-Object -Skip 1) ``` -### Example 7: Rename files and select several to review +### Example 8: Rename files and select several to review This example adds a "-ro" suffix to the base names of text files that have the read-only attribute and then displays the first five files so the user can see a sample of the effect. @@ -193,7 +210,7 @@ Get-ChildItem *.txt -ReadOnly | Select-Object -First 5 -Wait ``` -### Example 8: Demonstrate the intricacies of the -ExpandProperty parameter +### Example 9: Demonstrate the intricacies of the -ExpandProperty parameter This example demonstrates the intricacies of the **ExpandProperty** parameter. @@ -251,7 +268,7 @@ ToUInt64 Method uint64 IConvertible.ToUInt64(System.IFormatProvider pro Name NoteProperty string Name=CustomObject ``` -### Example 9: Create custom properties on objects +### Example 10: Create custom properties on objects The following example demonstrates using `Select-Object` to add a custom property to any object. When you specify a property name that does not exist, `Select-Object` creates that property as a @@ -269,7 +286,7 @@ MyCustomProperty New Custom Property ``` -### Example 10: Create calculated properties for each InputObject +### Example 11: Create calculated properties for each InputObject This example demonstrates using `Select-Object` to add calculated properties to your input. Passing a **ScriptBlock** to the **Property** parameter causes `Select-Object` to evaluate the expression on @@ -527,6 +544,8 @@ Accept wildcard characters: False Specifies that if a subset of the input objects has identical properties and values, only a single member of the subset will be selected. +**Unique** selects values _after_ other filtering parameters are applied. + This parameter is case-sensitive. As a result, strings that differ only in character casing are considered to be unique. diff --git a/reference/7.1/Microsoft.PowerShell.Utility/Select-Object.md b/reference/7.1/Microsoft.PowerShell.Utility/Select-Object.md index 3bfb6c3a3a1d..7dd28d72693e 100644 --- a/reference/7.1/Microsoft.PowerShell.Utility/Select-Object.md +++ b/reference/7.1/Microsoft.PowerShell.Utility/Select-Object.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 09/25/2020 +ms.date: 10/15/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/select-object?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: Select-Object @@ -147,7 +147,24 @@ b c ``` -### Example 5: Select newest and oldest events in the event log +### Example 5: Using `-Unique` with other parameters + +The **Unique** parameter filters values after other `Select-Object` parameters are applied. For +example, if you use the **First** parameter to select the first number of items in an array, **Unique** +is only applied to the selected values and not the entire array. + +```powershell +"a","a","b","c" | Select-Object -First 2 -Unique +``` + +```Output +a +``` + +In this example, **First** selects `"a","a"` as the first 2 items in the array. **Unique** is +applied to `"a","a"` and returns `a` as the unique value. + +### Example 6: Select newest and oldest events in the event log This example gets the first (newest) and last (oldest) events in the Windows PowerShell event log. @@ -161,7 +178,7 @@ $a = Get-EventLog -LogName "Windows PowerShell" $a | Select-Object -Index 0, ($A.count - 1) ``` -### Example 6: Select all but the first object +### Example 7: Select all but the first object This example creates a new PSSession on each of the computers listed in the Servers.txt files, except for the first one. @@ -173,7 +190,7 @@ of computers is set as the value of the **ComputerName** parameter of the `New-P New-PSSession -ComputerName (Get-Content Servers.txt | Select-Object -Skip 1) ``` -### Example 7: Rename files and select several to review +### Example 8: Rename files and select several to review This example adds a "-ro" suffix to the base names of text files that have the read-only attribute and then displays the first five files so the user can see a sample of the effect. @@ -193,7 +210,7 @@ Get-ChildItem *.txt -ReadOnly | Select-Object -First 5 -Wait ``` -### Example 8: Demonstrate the intricacies of the -ExpandProperty parameter +### Example 9: Demonstrate the intricacies of the -ExpandProperty parameter This example demonstrates the intricacies of the **ExpandProperty** parameter. @@ -251,7 +268,7 @@ ToUInt64 Method uint64 IConvertible.ToUInt64(System.IFormatProvider pro Name NoteProperty string Name=CustomObject ``` -### Example 9: Create custom properties on objects +### Example 10: Create custom properties on objects The following example demonstrates using `Select-Object` to add a custom property to any object. When you specify a property name that does not exist, `Select-Object` creates that property as a @@ -269,7 +286,7 @@ MyCustomProperty New Custom Property ``` -### Example 10: Create calculated properties for each InputObject +### Example 11: Create calculated properties for each InputObject This example demonstrates using `Select-Object` to add calculated properties to your input. Passing a **ScriptBlock** to the **Property** parameter causes `Select-Object` to evaluate the expression on @@ -527,6 +544,8 @@ Accept wildcard characters: False Specifies that if a subset of the input objects has identical properties and values, only a single member of the subset will be selected. +**Unique** selects values _after_ other filtering parameters are applied. + This parameter is case-sensitive. As a result, strings that differ only in character casing are considered to be unique. diff --git a/reference/7.2/Microsoft.PowerShell.Utility/Select-Object.md b/reference/7.2/Microsoft.PowerShell.Utility/Select-Object.md index 91ddb543cc81..9ec23ed80ea5 100644 --- a/reference/7.2/Microsoft.PowerShell.Utility/Select-Object.md +++ b/reference/7.2/Microsoft.PowerShell.Utility/Select-Object.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility -ms.date: 09/25/2020 +ms.date: 10/15/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/select-object?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: Select-Object @@ -147,7 +147,24 @@ b c ``` -### Example 5: Select newest and oldest events in the event log +### Example 5: Using `-Unique` with other parameters + +The **Unique** parameter filters values after other `Select-Object` parameters are applied. For +example, if you use the **First** parameter to select the first number of items in an array, **Unique** +is only applied to the selected values and not the entire array. + +```powershell +"a","a","b","c" | Select-Object -First 2 -Unique +``` + +```Output +a +``` + +In this example, **First** selects `"a","a"` as the first 2 items in the array. **Unique** is +applied to `"a","a"` and returns `a` as the unique value. + +### Example 6: Select newest and oldest events in the event log This example gets the first (newest) and last (oldest) events in the Windows PowerShell event log. @@ -161,7 +178,7 @@ $a = Get-EventLog -LogName "Windows PowerShell" $a | Select-Object -Index 0, ($A.count - 1) ``` -### Example 6: Select all but the first object +### Example 7: Select all but the first object This example creates a new PSSession on each of the computers listed in the Servers.txt files, except for the first one. @@ -173,7 +190,7 @@ of computers is set as the value of the **ComputerName** parameter of the `New-P New-PSSession -ComputerName (Get-Content Servers.txt | Select-Object -Skip 1) ``` -### Example 7: Rename files and select several to review +### Example 8: Rename files and select several to review This example adds a "-ro" suffix to the base names of text files that have the read-only attribute and then displays the first five files so the user can see a sample of the effect. @@ -193,7 +210,7 @@ Get-ChildItem *.txt -ReadOnly | Select-Object -First 5 -Wait ``` -### Example 8: Demonstrate the intricacies of the -ExpandProperty parameter +### Example 9: Demonstrate the intricacies of the -ExpandProperty parameter This example demonstrates the intricacies of the **ExpandProperty** parameter. @@ -251,7 +268,7 @@ ToUInt64 Method uint64 IConvertible.ToUInt64(System.IFormatProvider pro Name NoteProperty string Name=CustomObject ``` -### Example 9: Create custom properties on objects +### Example 10: Create custom properties on objects The following example demonstrates using `Select-Object` to add a custom property to any object. When you specify a property name that does not exist, `Select-Object` creates that property as a @@ -269,7 +286,7 @@ MyCustomProperty New Custom Property ``` -### Example 10: Create calculated properties for each InputObject +### Example 11: Create calculated properties for each InputObject This example demonstrates using `Select-Object` to add calculated properties to your input. Passing a **ScriptBlock** to the **Property** parameter causes `Select-Object` to evaluate the expression on @@ -527,6 +544,8 @@ Accept wildcard characters: False Specifies that if a subset of the input objects has identical properties and values, only a single member of the subset will be selected. +**Unique** selects values _after_ other filtering parameters are applied. + This parameter is case-sensitive. As a result, strings that differ only in character casing are considered to be unique. diff --git a/reference/docs-conceptual/install/Installing-PowerShell-on-Windows.md b/reference/docs-conceptual/install/Installing-PowerShell-on-Windows.md index d3a8231049a5..24a9fc123ea1 100644 --- a/reference/docs-conceptual/install/Installing-PowerShell-on-Windows.md +++ b/reference/docs-conceptual/install/Installing-PowerShell-on-Windows.md @@ -1,23 +1,21 @@ --- description: Information about installing PowerShell on Windows -ms.date: 10/14/2021 +ms.date: 10/15/2021 title: Installing PowerShell on Windows --- # Installing PowerShell on Windows -There are multiple ways to install PowerShell in Windows. +There are multiple ways to install PowerShell in Windows. Each install method is designed to support +different scenarios and workflows. Choose the method that best suits your needs. -## Supported versions of Windows - -[!INCLUDE [Windows support](../../includes/windows-support.md)] - -You can check the version that you are using by running `winver.exe`. - -## Installing the MSI package - -To install PowerShell on Windows, download the install package from GitHub. Scroll down to the -**Assets** section of the Release page. The **Assets** section may be collapsed, so you may need to -click to expand it. +- [MSI package](#msi) - The best choice for the everyday user. +- [ZIP package](#zip) - The easiest way to install multiple versions or use in a CI/CD pipeline. + This is the install method for Windows Nano Server, Windows IoT, and Arm-based systems. +- [.NET Global tool](#dotnet) - A good choice for .NET developers that install and use other global + tools. +- [Winget](#winget) - For users that prefer to use the new Windows Package Manager tool. +- [Microsoft Store package](#msstore) - An easy way to install for casual users of PowerShell but + has limitations. > [!NOTE] > The installation commands in this article are for the latest stable release of PowerShell. To @@ -26,15 +24,21 @@ click to expand it. > GitHub. > > - Stable release: [https://aka.ms/powershell-release?tag=stable][current] -> - Preview release: [https://aka.ms/powershell-release?tag=preview][preview] > - LTS release: [https://aka.ms/powershell-release?tag=lts][lts] +> - Preview release: [https://aka.ms/powershell-release?tag=preview][preview] +> +> Download links for every package are found in the **Assets** section of the Release page. The +> **Assets** section may be collapsed, so you may need to click to expand it. + +## Installing the MSI package -The MSI file looks like `PowerShell--win-.msi`. For example: +To install PowerShell on Windows, use the following links to download the install package from +GitHub. - [PowerShell-7.1.5-win-x64.msi][x64msi] - [PowerShell-7.1.5-win-x86.msi][x86msi] -Once downloaded, double-click the installer and follow the prompts. +Once downloaded, double-click the installer file and follow the prompts. The installer creates a shortcut in the Windows Start Menu. @@ -51,32 +55,6 @@ The installer creates a shortcut in the Windows Start Menu. > > If you need to run PowerShell 7.1 side-by-side with other versions, use the [ZIP install](#zip) > method to install the other version to a different folder. -> -> Preview releases of PowerShell 7 install to `$env:ProgramFiles\PowerShell\7-preview` so they can -> be run side-by-side with non-preview releases of PowerShell. PowerShell 7.2-preview.10 is the -> current preview release. - -### Support for Microsoft Update in PowerShell 7.2 - -PowerShell 7.2-preview.10 has support for Microsoft Update. When you enable this feature, you'll get -the latest PowerShell 7 updates in your traditional Microsoft Update (MU) management flow, whether -that's with Windows Update for Business, WSUS, SCCM, or the interactive MU dialog in Settings. - -The PowerShell 7.2 MSI package includes following command-line options: - -- `USE_MU` - This property has two possible values: - - `1` (default) - Opts into updating through Microsoft Update, WSUS, or SCCM - - `0` - Do not opt into updating through Microsoft Update, WSUS, or SCCM -- `ENABLE_MU` - - `1` (default) - Opts into using Microsoft Update for Automatic Updates - - `0` - Do not opt into using Microsoft Update - -> [!NOTE] -> Enabling updates may have been set in a previous installation or manual configuration. Using -> `ENABLE_MU=0` does not remove the existing settings. Also, this setting can be overruled by Group -> Policy settings controlled by your administrator. - -For more information, see the [PowerShell Microsoft Update FAQ](microsoft-update-faq.yml). ### Administrative install from the command line @@ -122,6 +100,114 @@ Use this method to install the ARM-based version of PowerShell on computers like Surface Pro X. For best results, install PowerShell to the to `$env:ProgramFiles\PowerShell\7` folder. +## Install as a .NET Global tool + +If you already have the [.NET Core SDK](/dotnet/core/sdk) installed, you can install PowerShell as a +[.NET Global tool](/dotnet/core/tools/global-tools). + +``` +dotnet tool install --global PowerShell +``` + +The dotnet tool installer adds `$env:USERPROFILE\.dotnet\tools` to your `$env:PATH` environment +variable. However, the currently running shell doesn't have the updated `$env:PATH`. You can start +PowerShell from a new shell by typing `pwsh`. + +## Install PowerShell using Winget + +Winget, the Windows Package Manager, is a command-line tool enables developers to discover, install, +upgrade, remove, and configure applications on Windows 10 computers. This tool is the client +interface to the Windows Package Manager service. + +> [!NOTE] +> See the [winget documentation][winget] for a list of system requirements and install instructions. + +The following commands can be used to install PowerShell using the published `winget` packages: + +Search for the latest version of PowerShell + +```powershell +winget search Microsoft.PowerShell +``` + +```Output +Name Id Version Source +---------------------------------------------------------------- +PowerShell Microsoft.PowerShell 7.1.5.0 winget +Powershell Preview Microsoft.PowerShell.Preview 7.2.0.10 winget +``` + +Install a version of PowerShell using the `--exact` parameter + +```powershell +winget install --name PowerShell --exact --source winget +winget install --name PowerShell-Preview --exact --source winget +``` + +## Installing from the Microsoft Store + +PowerShell 7.1 has been published to the Microsoft Store. You can find the PowerShell release in the +[Microsoft Store][store-app] site or in the Store application in Windows. + +Benefits of the Microsoft Store package: + +- Automatic updates built right into Windows +- Integrates with other software distribution mechanisms like Intune and SCCM + +### Known limitations + +Windows Store packages run in an application sandbox that virtualizes access to some filesystem and +registry locations. + +- All registry changes under HKEY_CURRENT_USER are copied on write to a private, per-user, per-app + location. Therefore, those values are not available to other applications. +- Any system-level configuration settings stored in `$PSHOME` cannot be modified. This includes the + WSMAN configuration. This prevents remote sessions from connecting to Store-based installs of + PowerShell. User-level configurations and SSH remoting are supported. + +For more information, see +[Understanding how packaged desktop apps run on Windows](/windows/msix/desktop/desktop-to-uwp-behind-the-scenes). + +## Installing a preview version + +The preview version of PowerShell 7.2 can be downloaded using the following link: + +- [PowerShell-7.2.0-preview.10-win-x64.msi][72x64msi] + +Preview releases of PowerShell 7 install to `$env:ProgramFiles\PowerShell\7-preview` so they can +be run side-by-side with non-preview releases of PowerShell. PowerShell 7.2-preview.10 is the +current preview release. + +### Support for Microsoft Update in PowerShell 7.2 + +PowerShell 7.2-preview.10 has support for Microsoft Update. When you enable this feature, you'll get +the latest PowerShell 7 updates in your traditional Microsoft Update (MU) management flow, whether +that's with Windows Update for Business, WSUS, SCCM, or the interactive MU dialog in Settings. + +The PowerShell 7.2 MSI package includes following command-line options: + +- `USE_MU` - This property has two possible values: + - `1` (default) - Opts into updating through Microsoft Update, WSUS, or SCCM + - `0` - Do not opt into updating through Microsoft Update, WSUS, or SCCM +- `ENABLE_MU` + - `1` (default) - Opts into using Microsoft Update for Automatic Updates + - `0` - Do not opt into using Microsoft Update + +> [!NOTE] +> Enabling updates may have been set in a previous installation or manual configuration. Using +> `ENABLE_MU=0` does not remove the existing settings. Also, this setting can be overruled by Group +> Policy settings controlled by your administrator. + +For more information, see the [PowerShell Microsoft Update FAQ](microsoft-update-faq.yml). + +## Upgrading an existing installation + +For best results when upgrading, you should use the same install method you used when you first +installed PowerShell. Each installation method installs PowerShell in a different location. If you +are not sure how PowerShell was installed, you can compare the installed location with the package +information in this article. If you installed via the MSI package, that information appears in the +**Programs and Features** Control Panel. + ## Deploying on Windows 10 IoT Enterprise Windows 10 IoT Enterprise comes with Windows PowerShell, which we can use to deploy PowerShell 7. @@ -186,7 +272,7 @@ PowerShell binaries can be deployed using two different methods. location within the mounted image. 1. Online - Transfer the zip file over a PowerShell Session and unzip it in your chosen location. -In both cases, you need the Windows x64 ZIP release package. Run the commands within an +In both cases, you need the [Windows x64 ZIP release package][x64zip]. Run the commands within an "Administrator" instance of PowerShell. ### Offline Deployment of PowerShell @@ -220,74 +306,6 @@ Expand-Archive -Path C:\PowerShell-7.1.5-win-x64.zip -DestinationPath 'C:\Progra If you want WSMan-based remoting, follow the instructions to create a remoting endpoint using the ["another instance technique"][instance]. -## Install as a .NET Global tool - -If you already have the [.NET Core SDK](/dotnet/core/sdk) installed, you can install PowerShell as a -[.NET Global tool](/dotnet/core/tools/global-tools). - -``` -dotnet tool install --global PowerShell -``` - -The dotnet tool installer adds `$env:USERPROFILE\.dotnet\tools` to your `$env:PATH` environment -variable. However, the currently running shell doesn't have the updated `$env:PATH`. You can start -PowerShell from a new shell by typing `pwsh`. - -## Install PowerShell via the Windows Package Manager - -The `winget` command-line tool enables developers to discover, install, upgrade, remove, and -configure applications on Windows 10 computers. This tool is the client interface to the Windows -Package Manager service. - -> [!NOTE] -> See the [winget documentation][winget] for a list of system requirements and install instructions. - -The following commands can be used to install PowerShell using the published `winget` packages: - -Search for the latest version of PowerShell - -```powershell -winget search Microsoft.PowerShell -``` - -```Output -Name Id Version Source ----------------------------------------------------------------- -PowerShell Microsoft.PowerShell 7.1.5.0 winget -Powershell Preview Microsoft.PowerShell.Preview 7.2.0.10 winget -``` - -Install a version of PowerShell using the `--exact` parameter - -```powershell -winget install --name PowerShell --exact --source winget -winget install --name PowerShell-Preview --exact --source winget -``` - -## Installing from the Microsoft Store - -PowerShell 7.1 has been published to the Microsoft Store. You can find the PowerShell release in the -[Microsoft Store][store-app] site or in the Store application in Windows. - -Benefits of the Microsoft Store package: - -- Automatic updates built right into Windows -- Integrates with other software distribution mechanisms like Intune and SCCM - -### Known limitations - -Windows Store packages run in an application sandbox that virtualizes access to some filesystem and -registry locations. - -- All registry changes under HKEY_CURRENT_USER are copied on write to a private, per-user, per-app - location. Therefore, those values are not available to other applications. -- Any system-level configuration settings stored in `$PSHOME` cannot be modified. This includes the - WSMAN configuration. This prevents remote sessions from connecting to Store-based installs of - PowerShell. User-level configurations and SSH remoting are supported. - -For more information, see -[Understanding how packaged desktop apps run on Windows](/windows/msix/desktop/desktop-to-uwp-behind-the-scenes). - ## PowerShell remoting PowerShell supports the PowerShell Remoting Protocol (PSRP) over both WSMan and SSH. For more @@ -305,13 +323,11 @@ of Windows. Windows versions predating Windows 10. It's available via direct download or Windows Update. Fully patched systems already have this package installed. -## Upgrading an existing installation +## Supported versions of Windows -For best results when upgrading, you should use the same install method you used when you first -installed PowerShell. Each installation method installs PowerShell in a different location. If you -are not sure how PowerShell was installed, you can compare the installed location with the package -information in this article. If you installed via the MSI package, that information appears in the -**Programs and Features** Control Panel. +[!INCLUDE [Windows support](../../includes/windows-support.md)] + +You can check the version that you are using by running `winver.exe`. ## Installation support @@ -341,3 +357,4 @@ cannot support those methods. [x64zip]: https://github.com/PowerShell/PowerShell/releases/download/v7.1.5/PowerShell-7.1.5-win-x64.zip [x86msi]: https://github.com/PowerShell/PowerShell/releases/download/v7.1.5/PowerShell-7.1.5-win-x86.msi [x86zip]: https://github.com/PowerShell/PowerShell/releases/download/v7.1.5/PowerShell-7.1.5-win-x86.zip +[72x64msi]: https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/PowerShell-7.2.0-preview.10-win-x64.msi diff --git a/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md b/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md index 0ffd996adbed..6691f8de3392 100644 --- a/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md +++ b/reference/docs-conceptual/install/Installing-PowerShell-on-macOS.md @@ -1,13 +1,14 @@ --- description: Information about installing PowerShell on macOS -ms.date: 10/14/2021 +ms.date: 10/15/2021 title: Installing PowerShell on macOS --- # Installing PowerShell on macOS PowerShell 7.0 or higher require macOS 10.13 and higher. All packages are available on our GitHub -[releases][releases] page. After the package is installed, run `pwsh` from a terminal. +[releases][releases] page. After the package is installed, run `pwsh` from a terminal. Before +installing, check the list of [Supported versions](#supported-versions) below. > [!NOTE] > PowerShell 7.2 is an in-place upgrade that removes previous versions of PowerShell 6.x and 7.x. @@ -17,10 +18,6 @@ PowerShell 7.0 or higher require macOS 10.13 and higher. All packages are availa > If you need to run an older version of PowerShell side-by-side with PowerShell 7.2, install > the version you want using the [binary archive](#binary-archives) method. -## Supported versions of macOS - -[!INCLUDE [macOS support](../../includes/macos-support.md)] - ## Installation of latest stable release via Homebrew on macOS 10.13 or higher There are several ways to install PowerShell on macOS. Choose one of the following methods: @@ -67,8 +64,8 @@ brew upgrade powershell --cask ## Installation of latest preview release via Homebrew on macOS 10.13 or higher -After you've installed Homebrew, you can install PowerShell. First, install the [Cask-Versions][cask-versions] -package that lets you install alternative versions of cask packages: +After you've installed Homebrew, you can install PowerShell. First, install the +[Cask-Versions][cask-versions] package that lets you install alternative versions of cask packages: ```sh brew tap homebrew/cask-versions @@ -110,7 +107,7 @@ You can now verify your install pwsh ``` -When new versions of PowerShell are released, simply run the following command. +When new versions of PowerShell are released, run the following command. ```sh brew upgrade powershell @@ -126,14 +123,14 @@ brew upgrade powershell ## Installation via Direct Download -PowerShell 7.2 addes support for the Apple M1 processor. Download the install package from the +PowerShell 7.2 adds support for the Apple M1 processor. Download the install package from the [releases][releases] page onto your computer. The links to the current versions are: - PowerShell 7.2-preview.10 - - x64 processors - `https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/powershell-7.2.0-preview.10-osx-x64.pkg` - - M1 processors - `https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/powershell-7.2.0-preview.10-osx-arm64.pkg` -- PowerShell 7.1.5 - `https://github.com/PowerShell/PowerShell/releases/download/v7.1.5/powershell-7.1.5-osx-x64.pkg` -- PowerShell 7.0.8 - `https://github.com/PowerShell/PowerShell/releases/download/v7.0.8/powershell-7.0.8-osx-x64.pkg` + - x64 processors - [powershell-7.2.0-preview.10-osx-x64.pkg][72x64pkg] + - M1 processors - [powershell-7.2.0-preview.10-osx-arm64.pkg][72m1pkg] +- PowerShell 7.1.5 - [powershell-7.1.5-osx-x64.pkg][71x64pkg] +- PowerShell 7.0.8 - [powershell-7.0.8-osx-x64.pkg][70x64pkg] You can double-click the file and follow the prompts, or install it from the terminal using the following commands. Change the name of the file to match the file you downloaded. @@ -172,9 +169,9 @@ operations. > [!NOTE] > You can use this method to install any version of PowerShell including the latest: -> - Stable release: [https://aka.ms/powershell-release?tag=stable](https://aka.ms/powershell-release?tag=stable) -> - Preview release: [https://aka.ms/powershell-release?tag=preview](https://aka.ms/powershell-release?tag=preview) -> - LTS release: [https://aka.ms/powershell-release?tag=lts](https://aka.ms/powershell-release?tag=lts) +> - Stable release: [https://aka.ms/powershell-release?tag=stable][current] +> - LTS release: [https://aka.ms/powershell-release?tag=lts][lts] +> - Preview release: [https://aka.ms/powershell-release?tag=preview][preview] ### Installing binary archives on macOS @@ -182,10 +179,11 @@ Download the install package from the [releases][releases] page onto your comput current versions are: - PowerShell 7.2-preview.10 - - x64 processors - `https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/powershell-7.2.0-preview.10-osx-x64.tar.gz` - - M1 processors - `https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/powershell-7.2.0-preview.10-osx-arm64.tar.gz` -- PowerShell 7.1.5 - `https://github.com/PowerShell/PowerShell/releases/download/v7.1.5/powershell-7.1.5-osx-x64.tar.gz` -- PowerShell 7.0.8 - `https://github.com/PowerShell/PowerShell/releases/download/v7.0.8/powershell-7.0.8-osx-x64.tar.gz` + - x64 processors - [powershell-7.2.0-preview.10-osx-x64.tar.gz][72x64bin] + - M1 processors - [powershell-7.2.0-preview.10-osx-arm64.tar.gz][72m1bin] +- PowerShell 7.1.5 - [powershell-7.1.5-osx-x64.tar.gz][71x64bin] +- PowerShell 7.0.8 - [powershell-7.0.8-osx-x64.tar.gz][70x64bin] + Use the following commands to install PowerShell from the binary archive. Change the download URL to match the version you want to install. @@ -194,7 +192,7 @@ match the version you want to install. # Download the powershell '.tar.gz' archive curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.1.5/powershell-7.1.5-osx-x64.tar.gz -# Create the target folder where powershell will be placed +# Create the target folder where powershell is placed sudo mkdir -p /usr/local/microsoft/powershell/7.1.5 # Expand powershell to the target folder @@ -258,12 +256,12 @@ and remove the paths using `sudo rm`. ## Paths - `$PSHOME` is `/usr/local/microsoft/powershell/7.1.5/` -- User profiles will be read from `~/.config/powershell/profile.ps1` -- Default profiles will be read from `$PSHOME/profile.ps1` -- User modules will be read from `~/.local/share/powershell/Modules` -- Shared modules will be read from `/usr/local/share/powershell/Modules` -- Default modules will be read from `$PSHOME/Modules` -- PSReadline history will be recorded to `~/.local/share/powershell/PSReadLine/ConsoleHost_history.txt` +- User profiles are read from `~/.config/powershell/profile.ps1` +- Default profiles are read from `$PSHOME/profile.ps1` +- User modules are read from `~/.local/share/powershell/Modules` +- Shared modules are read from `/usr/local/share/powershell/Modules` +- Default modules are read from `$PSHOME/Modules` +- PSReadLine history are recorded to `~/.local/share/powershell/PSReadLine/ConsoleHost_history.txt` The profiles respect PowerShell's per-host configuration. So the default host-specific profile exists at `Microsoft.PowerShell_profile.ps1` in the same locations. @@ -274,6 +272,10 @@ Because macOS is a derivation of BSD, the prefix `/usr/local` is used instead of `$PSHOME` is `/usr/local/microsoft/powershell/7.1.5/`, and the symbolic link is placed at `/usr/local/bin/pwsh`. +## Supported versions + +[!INCLUDE [macOS support](../../includes/macos-support.md)] + ## Installation support Microsoft supports the installation methods in this document. There may be other methods of @@ -286,9 +288,24 @@ support those methods. - [Homebrew Github Repository][GitHub] - [Homebrew-Cask][cask] + + [brew]: https://docs.brew.sh/Installation [Cask]: https://github.com/Homebrew/homebrew-cask [cask-versions]: https://github.com/Homebrew/homebrew-cask-versions [GitHub]: https://github.com/Homebrew [releases]: https://aka.ms/powershell-release?tag=stable [xdg-bds]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +[current]: https://aka.ms/powershell-release?tag=stable +[lts]: https://aka.ms/powershell-release?tag=lts +[preview]: https://aka.ms/powershell-release?tag=preview + +[72x64pkg]: https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/powershell-7.2.0-preview.10-osx-x64.pkg +[72m1pkg]: https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/powershell-7.2.0-preview.10-osx-arm64.pkg +[71x64pkg]: https://github.com/PowerShell/PowerShell/releases/download/v7.1.5/powershell-7.1.5-osx-x64.pkg +[70x64pkg]: https://github.com/PowerShell/PowerShell/releases/download/v7.0.8/powershell-7.0.8-osx-x64.pkg + +[72x64bin]: https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/powershell-7.2.0-preview.10-osx-x64.tar.gz +[72m1bin]: https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/powershell-7.2.0-preview.10-osx-arm64.tar.gz +[71x64bin]: https://github.com/PowerShell/PowerShell/releases/download/v7.1.5/powershell-7.1.5-osx-x64.tar.gz +[70x64bin]: https://github.com/PowerShell/PowerShell/releases/download/v7.0.8/powershell-7.0.8-osx-x64.tar.gz diff --git a/reference/docs-conceptual/install/Installing-PowerShell.yml b/reference/docs-conceptual/install/Installing-PowerShell.yml index 023c8a65ff27..1b586484c415 100644 --- a/reference/docs-conceptual/install/Installing-PowerShell.yml +++ b/reference/docs-conceptual/install/Installing-PowerShell.yml @@ -33,7 +33,7 @@ landingContent: - text: Install on macOS url: Installing-PowerShell-on-macOS.md - text: Supported macOS releases - url: Installing-PowerShell-on-macOS.md#supported-versions-of-macos + url: Installing-PowerShell-on-macOS.md#supported-versions # Card - title: Linux diff --git a/reference/docs-conceptual/install/install-alpine.md b/reference/docs-conceptual/install/install-alpine.md index a047f157ee60..9b78b701c8a3 100644 --- a/reference/docs-conceptual/install/install-alpine.md +++ b/reference/docs-conceptual/install/install-alpine.md @@ -1,12 +1,13 @@ --- description: Information about installing PowerShell on Alpine Linux -ms.date: 10/14/2021 +ms.date: 10/15/2021 title: Installing PowerShell on Alpine Linux --- # Installing PowerShell on Alpine Linux All packages are available on our GitHub [releases][releases] page. After the package is installed, -run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. +run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. Before +installing, check the list of [Supported versions](#supported-versions) below. > [!NOTE] > PowerShell 7.2 is an in-place upgrade that removes previous versions of PowerShell. @@ -14,8 +15,6 @@ run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview releas > If you need to run PowerShell 7.2 side-by-side with a previous version, reinstall the previous > version using the [binary archive](install-other-linux.md#binary-archives) method. -[!INCLUDE [Alpine support](../../includes/alpine-support.md)] - ## Installation steps Installation on Alpine is based on downloading tar.gz package from the [releases][releases] page. The @@ -87,6 +86,10 @@ exists at `Microsoft.PowerShell_profile.ps1` in the same locations. PowerShell respects the [XDG Base Directory Specification][xdg-bds] on Linux. +## Supported versions + +[!INCLUDE [Alpine support](../../includes/alpine-support.md)] + ## Installation support Microsoft supports the installation methods in this document. There may be other methods of diff --git a/reference/docs-conceptual/install/install-centos.md b/reference/docs-conceptual/install/install-centos.md index cdd579519cd7..45a68e6b3bb9 100644 --- a/reference/docs-conceptual/install/install-centos.md +++ b/reference/docs-conceptual/install/install-centos.md @@ -1,12 +1,13 @@ --- description: Information about installing PowerShell on CentOS -ms.date: 10/14/2021 +ms.date: 10/15/2021 title: Installing PowerShell on CentOS --- # Installing PowerShell on CentOS All packages are available on our GitHub [releases][releases] page. After the package is installed, -run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. +run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. Before +installing, check the list of [Supported versions](#supported-versions) below. > [!NOTE] > PowerShell 7.2 is an in-place upgrade that removes previous versions of PowerShell. @@ -16,8 +17,6 @@ run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview releas CentOS 7 uses Yum as a package manager and CentOS 8 uses DNF. -[!INCLUDE [CentOS support](../../includes/centos-support.md)] - ## Installation via Package Repository (preferred) PowerShell for CentOS is published to official Microsoft repositories for easy installation and @@ -90,6 +89,10 @@ exists at `Microsoft.PowerShell_profile.ps1` in the same locations. PowerShell respects the [XDG Base Directory Specification][xdg-bds] on Linux. +## Supported versions + +[!INCLUDE [CentOS support](../../includes/centos-support.md)] + ## Installation support Microsoft supports the installation methods in this document. There may be other methods of diff --git a/reference/docs-conceptual/install/install-debian.md b/reference/docs-conceptual/install/install-debian.md index 1502f36407c0..c3b3c2fc543d 100644 --- a/reference/docs-conceptual/install/install-debian.md +++ b/reference/docs-conceptual/install/install-debian.md @@ -1,12 +1,13 @@ --- description: Information about installing PowerShell on Debian Linux -ms.date: 10/14/2021 +ms.date: 10/15/2021 title: Installing PowerShell on Debian Linux --- # Installing PowerShell on Debian Linux All packages are available on our GitHub [releases][releases] page. After the package is installed, -run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. +run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. Before +installing, check the list of [Supported versions](#supported-versions) below. > [!NOTE] > PowerShell 7.2 is an in-place upgrade that removes previous versions of PowerShell. @@ -16,8 +17,6 @@ run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview releas Debian uses APT (Advanced Package Tool) as a package manager. -[!INCLUDE [Debian support](../../includes/debian-support.md)] - ## Debian 10 > [!NOTE] @@ -111,6 +110,10 @@ exists at `Microsoft.PowerShell_profile.ps1` in the same locations. PowerShell respects the [XDG Base Directory Specification][xdg-bds] on Linux. +## Supported versions + +[!INCLUDE [Debian support](../../includes/debian-support.md)] + ## Installation support Microsoft supports the installation methods in this document. There may be other methods of diff --git a/reference/docs-conceptual/install/install-fedora.md b/reference/docs-conceptual/install/install-fedora.md index 565e3173293f..5eb115cb3189 100644 --- a/reference/docs-conceptual/install/install-fedora.md +++ b/reference/docs-conceptual/install/install-fedora.md @@ -1,12 +1,13 @@ --- description: Information about installing PowerShell on Fedora Linux -ms.date: 10/14/2021 +ms.date: 10/15/2021 title: Installing PowerShell on Fedora Linux --- # Installing PowerShell on Fedora Linux All packages are available on our GitHub [releases][releases] page. After the package is installed, -run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. +run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. Before +installing, check the list of [Supported versions](#supported-versions) below. > [!NOTE] > PowerShell 7.2 is an in-place upgrade that removes previous versions of PowerShell. @@ -16,8 +17,6 @@ run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview releas Fedora uses DNF as its package manager. -[!INCLUDE [Fedora support](../../includes/fedora-support.md)] - ## Installation via Package Repository PowerShell for Linux is published to official Microsoft repositories for easy installation and @@ -88,6 +87,10 @@ exists at `Microsoft.PowerShell_profile.ps1` in the same locations. PowerShell respects the [XDG Base Directory Specification][xdg-bds] on Linux. +## Supported versions + +[!INCLUDE [Fedora support](../../includes/fedora-support.md)] + ## Installation support Microsoft supports the installation methods in this document. There may be other methods of diff --git a/reference/docs-conceptual/install/install-rhel.md b/reference/docs-conceptual/install/install-rhel.md index f2ca839d7ce3..f443801ff0f3 100644 --- a/reference/docs-conceptual/install/install-rhel.md +++ b/reference/docs-conceptual/install/install-rhel.md @@ -1,12 +1,13 @@ --- description: Information about installing PowerShell on Red Hat Enterprise Linux (RHEL) -ms.date: 10/14/2021 +ms.date: 10/15/2021 title: Installing PowerShell on Red Hat Enterprise Linux (RHEL) --- # Installing PowerShell on Red Hat Enterprise Linux (RHEL) All packages are available on our GitHub [releases][releases] page. After the package is installed, -run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. +run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. Before +installing, check the list of [Supported versions](#supported-versions) below. > [!NOTE] > PowerShell 7.2 is an in-place upgrade that removes previous versions of PowerShell. @@ -16,8 +17,6 @@ run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview releas RHEL 7 uses yum and RHEL 8 uses the dnf package manager. -[!INCLUDE [RHEL support](../../includes/rhel-support.md)] - ## Installation via Package Repository PowerShell for Linux is published to official Microsoft repositories for easy installation and @@ -104,6 +103,10 @@ exists at `Microsoft.PowerShell_profile.ps1` in the same locations. PowerShell respects the [XDG Base Directory Specification][xdg-bds] on Linux. +## Supported versions + +[!INCLUDE [RHEL support](../../includes/rhel-support.md)] + ## Installation support Microsoft supports the installation methods in this document. There may be other methods of diff --git a/reference/docs-conceptual/install/install-ubuntu.md b/reference/docs-conceptual/install/install-ubuntu.md index 294941670849..233c83b31c92 100644 --- a/reference/docs-conceptual/install/install-ubuntu.md +++ b/reference/docs-conceptual/install/install-ubuntu.md @@ -1,12 +1,14 @@ --- description: Information about installing PowerShell on Ubuntu -ms.date: 10/14/2021 +ms.date: 10/15/2021 title: Installing PowerShell on Ubuntu --- # Installing PowerShell on Ubuntu All packages are available on our GitHub [releases][releases] page. After the package is installed, -run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. +run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview release. Before +installing, check the list of [Supported versions](#supported-versions) below. + > [!NOTE] > PowerShell 7.2 is an in-place upgrade that removes previous versions of PowerShell. @@ -16,8 +18,6 @@ run `pwsh` from a terminal. Run `pwsh-preview` if you installed a preview releas Ubuntu uses APT (Advanced Package Tool) as a package manager. -[!INCLUDE [Ubuntu support](../../includes/ubuntu-support.md)] - ## Installation via Package Repository PowerShell for Linux is published to package repositories for easy installation and updates. The URL @@ -101,6 +101,10 @@ exists at `Microsoft.PowerShell_profile.ps1` in the same locations. PowerShell respects the [XDG Base Directory Specification][xdg-bds] on Linux. +## Supported versions + +[!INCLUDE [Ubuntu support](../../includes/ubuntu-support.md)] + ## Installation support Microsoft supports the installation methods in this document. There may be other methods of diff --git a/reference/docs-conceptual/whats-new/Migrating-from-Windows-PowerShell-51-to-PowerShell-7.md b/reference/docs-conceptual/whats-new/Migrating-from-Windows-PowerShell-51-to-PowerShell-7.md index 0beb8d3d2e83..bc1a4d15342f 100644 --- a/reference/docs-conceptual/whats-new/Migrating-from-Windows-PowerShell-51-to-PowerShell-7.md +++ b/reference/docs-conceptual/whats-new/Migrating-from-Windows-PowerShell-51-to-PowerShell-7.md @@ -49,7 +49,7 @@ full installation. You may also install PowerShell 7 via the Windows Store or `winget`. For more information about both of these methods, see the detailed instructions in -[Installing PowerShell on Windows](../install/installing-powershell-on-windows.md#install-powershell-via-the-windows-package-manager). +[Installing PowerShell on Windows](../install/installing-powershell-on-windows.md#winget). ## Using PowerShell 7 side-by-side with Windows PowerShell 5.1