├── .config └── tsaoptions.json ├── .github ├── CODE_OF_CONDUCT.md └── SECURITY.md ├── .gitignore ├── .pipelines └── whatsnew-Official.yml ├── CHANGELOG.md ├── LICENSE ├── Microsoft.PowerShell.WhatsNew ├── Microsoft.PowerShell.WhatsNew.psd1 ├── Microsoft.PowerShell.WhatsNew.psm1 └── relnotes │ ├── What-s-New-in-PowerShell-70.md │ ├── What-s-New-in-PowerShell-71.md │ ├── What-s-New-in-PowerShell-72.md │ ├── What-s-New-in-PowerShell-73.md │ ├── What-s-New-in-PowerShell-74.md │ ├── What-s-New-in-PowerShell-75.md │ ├── What-s-New-in-PowerShell-Core-60.md │ ├── What-s-New-in-PowerShell-Core-61.md │ ├── What-s-New-in-PowerShell-Core-62.md │ └── What-s-New-in-Windows-PowerShell-50.md ├── README.md ├── build.ps1 ├── ci.yaml ├── releaseBuild.yml ├── spec ├── Get-WhatsNew.specification.md └── questions.md ├── templates ├── test-powershell.yaml └── test-pwsh.yaml └── test └── WhatsNew.Tests.ps1 /.config/tsaoptions.json: -------------------------------------------------------------------------------- 1 | { 2 | "instanceUrl": "https://msazure.visualstudio.com", 3 | "projectName": "One", 4 | "areaPath": "One\\MGMT\\Compute\\Powershell\\Powershell", 5 | "codebaseName": "TFSMSAzure_whatsnew", 6 | "notificationAliases": [ "sewhee@microsoft.com", "jahelmic@microsoft.com", "slee@microsoft.com" ], 7 | "tools": [ "CredScan", "PoliCheck", "BinSkim" ] 8 | } 9 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | - Employees can reach out at [aka.ms/opensource/moderation-support](https://aka.ms/opensource/moderation-support) 11 | -------------------------------------------------------------------------------- /.github/SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin) and [PowerShell](https://github.com/PowerShell). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /out 2 | *.nupkg 3 | testResults.xml -------------------------------------------------------------------------------- /.pipelines/whatsnew-Official.yml: -------------------------------------------------------------------------------- 1 | name: WhatsNew-ModuleBuild-$(Build.BuildId) 2 | trigger: none 3 | pr: none 4 | parameters: 5 | - name: 'publishToPowerShellGallery' 6 | displayName: 'Publish module to PowerShell gallery' 7 | type: boolean 8 | default: false 9 | 10 | variables: 11 | BuildConfiguration: Release 12 | DOTNET_NOLOGO: true 13 | DOTNET_GENERATE_ASPNET_CERTIFICATE: false 14 | DOTNET_CLI_TELEMETRY_OPTOUT: 1 15 | POWERSHELL_TELEMETRY_OPTOUT: 1 16 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 17 | WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest 18 | 19 | resources: 20 | repositories: 21 | - repository: templates 22 | type: git 23 | name: OneBranch.Pipelines/GovernedTemplates 24 | ref: refs/heads/main 25 | 26 | extends: 27 | # https://aka.ms/obpipelines/templates 28 | template: v2/OneBranch.Official.CrossPlat.yml@templates 29 | parameters: 30 | featureFlags: 31 | WindowsHostVersion: '1ESWindows2022' 32 | globalSdl: # https://aka.ms/obpipelines/sdl 33 | asyncSdl: 34 | enabled: true 35 | forStages: [build] 36 | stages: 37 | - stage: build 38 | jobs: 39 | - job: main 40 | displayName: Build package 41 | pool: 42 | type: windows 43 | variables: 44 | - name: ob_outputDirectory 45 | value: $(Build.SourcesDirectory)/out 46 | steps: 47 | - pwsh: | 48 | Write-Verbose -Verbose ((Get-Item $(Build.SourcesDirectory)).FullName) 49 | $manifestData = Import-PowerShellDataFile -Path ./Microsoft.PowerShell.WhatsNew/Microsoft.PowerShell.WhatsNew.psd1 50 | $moduleVersion = $manifestData.ModuleVersion 51 | Write-Output "##vso[task.setvariable variable=version;isOutput=true]$moduleVersion" 52 | if ($manifestData.PrivateData.PsData.Prerelease) { 53 | $prerel = $manifestData.PrivateData.PSData.Prerelease 54 | $nupkgVersion = "${moduleVersion}-${prerel}" 55 | } else { 56 | $nupkgVersion = $moduleVersion 57 | } 58 | Write-Output "##vso[task.setvariable variable=nupkgversion;isOutput=true]$nupkgVersion" 59 | name: package 60 | displayName: Get version from project properties 61 | - task: onebranch.pipeline.version@1 62 | displayName: Set OneBranch version 63 | inputs: 64 | system: Custom 65 | customVersion: $(package.version) 66 | #- task: UseDotNet@2 67 | # displayName: Use .NET SDK 68 | # inputs: 69 | # packageType: sdk 70 | # useGlobalJson: true 71 | - pwsh: ./build.ps1 -publish 72 | displayName: Build WhatsNew 73 | - task: onebranch.pipeline.signing@1 74 | displayName: Sign 1st-party files 75 | inputs: 76 | command: sign 77 | signing_profile: external_distribution 78 | search_root: $(Build.SourcesDirectory)/out/Microsoft.PowerShell.WhatsNew 79 | files_to_sign: | 80 | **/*.psd1; 81 | **/*.psm1; 82 | **/*.ps1xml; 83 | **/*.ps1; 84 | - task: ArchiveFiles@2 85 | displayName: Zip module 86 | inputs: 87 | rootFolderOrFile: $(Build.SourcesDirectory)/out/Microsoft.PowerShell.WhatsNew 88 | includeRootFolder: false 89 | archiveType: zip 90 | archiveFile: out/Microsoft.PowerShell.WhatsNew-v$(package.version).zip 91 | - pwsh: | 92 | ./build.ps1 -package 93 | Write-Verbose -Verbose ((Get-Item .).FullName) 94 | Write-Verbose -Verbose ((Get-Item $(Build.SourcesDirectory)).FullName) 95 | Get-ChildItem $(Build.SourcesDirectory) -Recurse -File -Name | Write-Verbose -Verbose 96 | displayName: Package module 97 | - task: onebranch.pipeline.signing@1 98 | displayName: Sign NuGet package 99 | inputs: 100 | command: sign 101 | signing_profile: external_distribution 102 | search_root: $(Build.SourcesDirectory)/out 103 | files_to_sign: "**/*.nupkg" 104 | - stage: release 105 | dependsOn: build 106 | condition: ${{ parameters.publishToPowerShellGallery }} 107 | variables: 108 | version: $[ stageDependencies.build.main.outputs['package.version'] ] 109 | drop: $(Pipeline.Workspace)/drop_build_main 110 | jobs: 111 | - job: validation 112 | displayName: Manual validation 113 | pool: 114 | type: agentless 115 | timeoutInMinutes: 1440 116 | steps: 117 | - task: ManualValidation@0 118 | displayName: Wait 24 hours for validation 119 | inputs: 120 | notifyUsers: $(Build.RequestedForEmail) 121 | instructions: Please validate the release and then publish it! 122 | timeoutInMinutes: 1440 123 | - job: publish 124 | dependsOn: validation 125 | displayName: Publish to PowerShell Gallery 126 | pool: 127 | type: windows 128 | variables: 129 | ob_outputDirectory: $(Build.SourcesDirectory)/out 130 | steps: 131 | - download: current 132 | displayName: Download artifacts 133 | - pwsh: | 134 | Get-ChildItem -Recurse $(Pipeline.Workspace) | Out-String -Stream | Write-Verbose -Verbose 135 | displayName: Get downloaded artifact files 136 | - task: NuGetCommand@2 137 | displayName: Publish WhatsNew to PowerShell Gallery 138 | inputs: 139 | command: push 140 | packagesToPush: $(Pipeline.Workspace)/**/*.nupkg 141 | nuGetFeedType: external 142 | publishFeedCredentials: PowerShellGallery 143 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change log for Get-WhatsNew 2 | 3 | ## v0.5.5 4 | 5 | - Refresh release notes for 7.4.3 and add release notes for 7.5-preview.3 6 | 7 | ## v0.5.4 8 | 9 | - Refresh release notes for 7.4 GA release 10 | 11 | ## v0.5.3 12 | 13 | - Refresh release notes for 7.4-preview.4 14 | 15 | ## v0.5.2 16 | 17 | - Refresh release notes for 7.4-preview.3 18 | 19 | ## v0.5.1 20 | 21 | - Syncs changes to release notes for PS 7.2 and 7.3 22 | - Update release notes for 7.4-preview.2 23 | 24 | ## v0.5.0 25 | 26 | - Updated release notes files for 7.3 GA release 27 | 28 | ## v0.4.1 29 | 30 | - Updated release notes files 31 | 32 | ## v0.4.0 33 | 34 | - Initial public release 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Microsoft.PowerShell.WhatsNew/Microsoft.PowerShell.WhatsNew.psd1: -------------------------------------------------------------------------------- 1 | # Module manifest for module 'Microsoft.PowerShell.WhatsNew' 2 | @{ 3 | RootModule = 'Microsoft.PowerShell.WhatsNew.psm1' 4 | ModuleVersion = '0.5.5' 5 | GUID = 'e49f73fd-7419-4639-84d7-159ebc32645e' 6 | Author = 'sewhee@microsoft.com' 7 | CompanyName = 'Microsoft' 8 | Copyright = '(c) Microsoft Corporation. All rights reserved.' 9 | Description = @' 10 | The Get-WhatsNew cmdlet allows you to see What's New information from the release notes for 11 | PowerShell. By default it shows the release notes for the current version of PowerShell you are 12 | running. You can also provide a specific version or a range of versions to be displayed. 13 | 14 | The cmdlet can display release notes for the following versions of PowerShell 15 | - Windows PowerShell 5.1 16 | - PowerShell 6.0 17 | - PowerShell 6.1 18 | - PowerShell 6.2 19 | - PowerShell 7.0 20 | - PowerShell 7.1 21 | - PowerShell 7.2 22 | - PowerShell 7.3 23 | - PowerShell 7.4 24 | - PowerShell 7.5 (preview) 25 | 26 | By default, the cmdlet shows all of the release notes for a version. You can also limit it to 27 | display a single random section of the release notes. This can be used as a "Message of the Day". 28 | '@ 29 | PowerShellVersion = '5.1' 30 | FunctionsToExport = 'Get-WhatsNew' 31 | CmdletsToExport = @() 32 | VariablesToExport = '*' 33 | AliasesToExport = @() 34 | 35 | FileList = @( 36 | 'relnotes/What-s-New-in-PowerShell-70.md', 37 | 'relnotes/What-s-New-in-PowerShell-71.md', 38 | 'relnotes/What-s-New-in-PowerShell-72.md', 39 | 'relnotes/What-s-New-in-PowerShell-73.md', 40 | 'relnotes/What-s-New-in-PowerShell-74.md', 41 | 'relnotes/What-s-New-in-PowerShell-Core-60.md', 42 | 'relnotes/What-s-New-in-PowerShell-Core-61.md', 43 | 'relnotes/What-s-New-in-PowerShell-Core-62.md', 44 | 'relnotes/What-s-New-in-Windows-PowerShell-50.md' 45 | ) 46 | 47 | PrivateData = @{ 48 | PSData = @{ 49 | Tags = @('WhatsNew', 'ReleaseNotes', 'MOTD', 'MessageOfTheDay') 50 | LicenseUri = 'https://github.com/PowerShell/whatsnew/blob/main/LICENSE' 51 | ProjectUri = 'https://github.com/PowerShell/whatsnew' 52 | RequireLicenseAcceptance = $false 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Microsoft.PowerShell.WhatsNew/Microsoft.PowerShell.WhatsNew.psm1: -------------------------------------------------------------------------------- 1 |  2 | # This function returns the available versions found on the disk. 3 | # Optionally, it constructs the objects used in the script to display 4 | # the what's new document. 5 | function Get-AvailableVersion { 6 | param ( [switch]$urihashtable ) 7 | 8 | $versions = foreach($filename in Get-ChildItem "$PSScriptRoot/relnotes") { 9 | $fileVersion = $filename -replace ".*(\d)(\d).*",'$1.$2' 10 | # fix up version 5.0 to 5.1 11 | $fileVersion = $fileVersion -replace "5.0","5.1" 12 | $fileVersion 13 | } 14 | 15 | if ( $urihashtable ) { 16 | $filenameBase = "What-s-New-in-PowerShell" 17 | $urlBase = 'https://aka.ms/WhatsNew' 18 | foreach ( $version in $versions ) { 19 | $fileVersion = $version -replace "\." 20 | if ( $fileVersion -eq "51" ) { 21 | $fileBase = "What-s-New-in-Windows-PowerShell-50" 22 | } elseif ( $fileVersion -like "6*" ) { 23 | $fileBase = "${filenameBase}-Core-${fileVersion}" 24 | } else { 25 | $fileBase = "${filenameBase}-${fileVersion}" 26 | } 27 | @{ 28 | # construct the hashtable 29 | version = $version 30 | path = Join-Path -Path $PSScriptRoot "relnotes/${fileBase}.md" 31 | url = "${urlBase}${fileVersion}" 32 | } 33 | } 34 | } 35 | else { 36 | $versions | Sort-Object 37 | } 38 | } 39 | 40 | function TestVersion { 41 | param ( [string[]]$versions ) 42 | $allowedVersions = Get-AvailableVersion 43 | foreach ($version in $versions) { 44 | if ( $version -notmatch "\." ) { 45 | $version = "${version}.0" 46 | } 47 | if ( $allowedVersions -notcontains $version ) { 48 | throw ("'$version' not in: " + ( $allowedVersions -join ", ")) 49 | } 50 | } 51 | return $true 52 | } 53 | <# 54 | .SYNOPSIS 55 | Displays release notes for a version of PowerShell. 56 | 57 | .DESCRIPTION 58 | This cmdlet allows you to see What's New information from the release notes for PowerShell. By 59 | default it shows the release notes for the current version of PowerShell you are running. You 60 | can also provide a specific version or a range of versions to be displayed. 61 | 62 | The cmdlet can display release notes for the following versions of PowerShell 63 | - Windows PowerShell 5.1 64 | - PowerShell 6.0 65 | - PowerShell 6.1 66 | - PowerShell 6.2 67 | - PowerShell 7.0 68 | - PowerShell 7.1 69 | - PowerShell 7.2 70 | - PowerShell 7.3 71 | - PowerShell 7.4 72 | - PowerShell 7.5 (preview) 73 | 74 | By default, the cmdlet shows all of the release notes for a version. You can also limit it to 75 | display a single random section of the release notes. This can be used as a "Message of the Day". 76 | 77 | .EXAMPLE 78 | Get-WhatsNew 79 | 80 | Displays the release notes for the version of PowerShell in which the cmdlet is running. 81 | 82 | .EXAMPLE 83 | Get-WhatsNew -Version 5.1 84 | 85 | Displays the release notes for PowerShell 5.1 regardless of which version the cmdlet is running. 86 | 87 | .EXAMPLE 88 | Get-WhatsNew -Daily -Version 7.0, 7.1, 7.2 89 | 90 | Displays one randomly selected section of the release notes per version of PowerShell selected. 91 | 92 | .EXAMPLE 93 | Get-WhatsNew -All 94 | 95 | Displays all of the releases for all versions supported by the cmdlet. 96 | 97 | .EXAMPLE 98 | Get-WhatsNew -Online -Version 7.3 99 | 100 | Opens your web browser and takes you to the webpage for the specified version of the release 101 | notes. If no version is specified, it uses the current version. 102 | 103 | .EXAMPLE 104 | Get-WhatsNew -Version 7.0, 7.1, 7.2 105 | 106 | Displays the release notes for PowerShell 7.0 through PowerShell 7.2. 107 | #> 108 | function Get-WhatsNew { 109 | [CmdletBinding(DefaultParameterSetName = 'ByVersion')] 110 | param ( 111 | # The version number of PowerShell to be displayed. If not specified, the current version is used. 112 | [Parameter(Position=0,ParameterSetName='ByVersion')] 113 | [Parameter(Position=0,ParameterSetName='ByVersionDaily')] 114 | [Parameter(Position=0,ParameterSetName='ByVersionOnline')] 115 | [ValidateScript({TestVersion $_})] 116 | [string[]]$Version, 117 | 118 | # Dislays a single section of the releases for a version. Alias = `MOTD`. 119 | [Parameter(Mandatory,ParameterSetName='ByVersionDaily')] 120 | [Alias('MOTD')] 121 | [switch]$Daily, 122 | 123 | # Takes you to the release notes webpage for the specified version. 124 | [Parameter(Mandatory,ParameterSetName='ByVersionOnline')] 125 | [switch]$Online, 126 | 127 | # Displays release notes for all versions. 128 | [Parameter(Mandatory,ParameterSetName='AllVersions')] 129 | [switch]$All 130 | ) 131 | 132 | if ($Version.Count -eq 0) { 133 | $Version = '{0}.{1}' -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor 134 | } 135 | 136 | $Version = $Version | ForEach-Object { 137 | if ( $_ -notmatch "\." ) { 138 | "${_}.0" 139 | } else { 140 | $_ 141 | } 142 | } 143 | if ($All) { 144 | $versions = Get-AvailableVersion -uriHashtable 145 | } else { 146 | $versions = Get-AvailableVersion -uriHashtable | Where-Object {$_.version -in $Version} 147 | } 148 | 149 | # Resolve parameter set 150 | $mdfiles = @() 151 | if ($PsCmdlet.ParameterSetName -eq 'AllVersions') { 152 | $mdfiles = ($versions).path 153 | } else { 154 | $mdfiles = ($versions | Where-Object {$_.version -in $Version}).path 155 | } 156 | 157 | if ($PsCmdlet.ParameterSetName -eq 'ByVersionOnline') { 158 | if ($Version.Count -gt 1) { 159 | Write-Warning 'This -Online parameter only supports one value for -Version. Using first value.' 160 | } 161 | Start-Process ($versions | Where-Object {$_.version -in $Version[0]}).url 162 | return 163 | } 164 | 165 | # Scan release notes for H2 blocks 166 | $endMarker = '' 167 | foreach ($file in $mdfiles) { 168 | $mdtext = Get-Content $file -Encoding utf8 169 | $mdheaders = Select-String -Pattern '^##\s',$endMarker -Path $file 170 | 171 | ## Build a list of H2 blocks 172 | $blocklist = @() 173 | foreach ($hdr in $mdheaders) { 174 | if ($hdr.Line -ne $endMarker) { 175 | $block = @{ 176 | Name = $hdr.Line.Trim() 177 | StartLine = $hdr.LineNumber - 1 178 | EndLine = -1 179 | } 180 | $blocklist += $block 181 | } else { 182 | $blocklist[-1].EndLine = $hdr.LineNumber - 2 183 | } 184 | } 185 | if ($blocklist.Count -gt 0) { 186 | for ($x = 0; $x -lt $blocklist.Count; $x++) { 187 | if ($blocklist[$x].EndLine -eq -1) { 188 | $blocklist[$x].EndLine = $blocklist[($x + 1)].StartLine - 1 189 | } 190 | } 191 | } 192 | 193 | if ( $file[-5] -eq '5') { 194 | $fileVersion = '5.1' 195 | } else { 196 | $fileVersion = '{0}.{1}' -f $file[-5], $file[-4] 197 | } 198 | '# Release notes for PowerShell {0}{1}' -f $fileVersion, [System.Environment]::NewLine 199 | if ($Daily) { 200 | $block = $blocklist | Get-Random -SetSeed (get-date -UFormat '%s') 201 | $mdtext[$block.StartLine..$block.EndLine] 202 | } else { 203 | foreach ($block in $blocklist) { 204 | $mdtext[$block.StartLine..$block.EndLine] 205 | } 206 | } 207 | } 208 | } 209 | 210 | $sbVersions = { 211 | param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters) 212 | Get-AvailableVersion | 213 | Where-Object {$_ -like "$wordToComplete*"} | 214 | ForEach-Object { "'$_'"} 215 | } 216 | Register-ArgumentCompleter -CommandName Get-WhatsNew -ParameterName Version -ScriptBlock $sbVersions 217 | -------------------------------------------------------------------------------- /Microsoft.PowerShell.WhatsNew/relnotes/What-s-New-in-PowerShell-70.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: New features and changes released in PowerShell 7.0 3 | ms.date: 11/16/2022 4 | title: What's new in PowerShell 7.0 5 | --- 6 | 7 | # What's new in PowerShell 7.0 8 | 9 | PowerShell 7.0 is an open-source, cross-platform (Windows, macOS, and Linux) edition of PowerShell, 10 | built to manage heterogeneous environments and hybrid cloud. 11 | 12 | In this release, we're introducing a number of new features, including: 13 | 14 | - Pipeline parallelization with `ForEach-Object -Parallel` 15 | - New operators: 16 | - Ternary operator: `a ? b : c` 17 | - Pipeline chain operators: `||` and `&&` 18 | - Null conditional operators: `??` and `??=` 19 | - A simplified and dynamic error view and `Get-Error` cmdlet for easier investigation of errors 20 | - A compatibility layer that enables users to import modules in an implicit Windows PowerShell 21 | session 22 | - Automatic new version notifications 23 | - The ability to invoke DSC resources directly from PowerShell 7 (experimental) 24 | 25 | To see a full list of features and fixes, see the 26 | [changelogs][19]. 27 | 28 | ## Where can I install PowerShell? 29 | 30 | PowerShell 7 currently supports the following operating systems on x64, including: 31 | 32 | - Windows 8.1, and 10 33 | - Windows Server 2012, 2012 R2, 2016, and 2019 34 | - macOS 10.13+ 35 | - Red Hat Enterprise Linux (RHEL) / CentOS 7 36 | - Fedora 30+ 37 | - Debian 9 38 | - Ubuntu LTS 16.04+ 39 | - Alpine Linux 3.8+ 40 | 41 | Additionally, PowerShell 7.0 supports ARM32 and ARM64 flavors of Debian, Ubuntu, and ARM64 Alpine 42 | Linux. 43 | 44 | Check the installation instructions for your preferred operating system [Windows][13], [macOS][12], 45 | or [Linux][11]. 46 | 47 | While not officially supported, the community has also provided packages for [Arch][18] and Kali 48 | Linux. 49 | 50 | > [!NOTE] 51 | > Debian 10 and CentOS 8 currently don't support WinRM remoting. For details on setting up SSH-based 52 | > remoting, see [PowerShell Remoting over SSH][15]. 53 | 54 | For more up-to-date information about supported operating systems and support lifecycle, see the 55 | [PowerShell Support Lifecycle][16]. 56 | 57 | ## Running PowerShell 7 58 | 59 | PowerShell 7 installs to a directory separately from Windows PowerShell. This enables you to run 60 | PowerShell 7 side-by-side with Windows PowerShell 5.1. For PowerShell 6.x, PowerShell 7 is an 61 | in-place upgrade that removes PowerShell 6.x. 62 | 63 | - PowerShell 7 is installed to `%programfiles%\PowerShell\7` 64 | - The `%programfiles%\PowerShell\7` folder is added to `$env:PATH` 65 | 66 | The PowerShell 7 installer package upgrades previous versions of PowerShell 6.x: 67 | 68 | - PowerShell 6.x on Windows: `%programfiles%\PowerShell\6` is replaced by 69 | `%programfiles%\PowerShell\7` 70 | - Linux: `/opt/microsoft/powershell/6` is replaced by `/opt/microsoft/powershell/7` 71 | - macOS: `/usr/local/microsoft/powershell/6` is replaced by `/usr/local/microsoft/powershell/7` 72 | 73 | > [!NOTE] 74 | > In Windows PowerShell, the executable to launch PowerShell is named `powershell.exe`. In version 6 75 | > and above, the executable name is changed to support side-by-side execution. The new executable 76 | > name to launch PowerShell 7 is `pwsh.exe`. Preview builds remain in-place as `pwsh-preview` 77 | > instead of `pwsh` under the 7-preview directory. 78 | 79 | ## Improved backwards compatibility with Windows PowerShell 80 | 81 | PowerShell 7.0 marks a move a to .NET Core 3.1, enabling significantly more backwards compatibility 82 | with existing Windows PowerShell modules. This includes many modules on Windows that require GUI 83 | functionality like `Out-GridView` and `Show-Command`, as well as many role management modules that 84 | ship as part of Windows. 85 | 86 | For Windows, a new switch parameter **UseWindowsPowerShell** is added to `Import-Module`. This 87 | switch creates a proxy module in PowerShell 7 that uses a local Windows PowerShell process to 88 | implicitly run any cmdlets contained in that module. For more information on [Import-Module][08]. 89 | 90 | For more information on which Microsoft modules work with PowerShell 7.0, see the 91 | [Module Compatibility Table][17]. 92 | 93 | ## Parallel execution added to ForEach-Object 94 | 95 | The `ForEach-Object` cmdlet, which iterates items in a collection, now has built-in parallelism with 96 | the new **Parallel** parameter. 97 | 98 | By default, parallel script blocks use the current working directory of the caller that started the 99 | parallel tasks. 100 | 101 | This example retrieves 50,000 log entries from 5 system logs on a local Windows machine: 102 | 103 | ```powershell 104 | $logNames = 'Security','Application','System','Windows PowerShell','Microsoft-Windows-Store/Operational' 105 | 106 | $logEntries = $logNames | ForEach-Object -Parallel { 107 | Get-WinEvent -LogName $_ -MaxEvents 10000 108 | } -ThrottleLimit 5 109 | 110 | $logEntries.Count 111 | 112 | 50000 113 | ``` 114 | 115 | The **Parallel** parameter specifies the script block that's run in parallel for each input log 116 | name. 117 | 118 | The new **ThrottleLimit** parameter limits the number of script blocks running in parallel at a 119 | given time. The default is 5. 120 | 121 | Use the `$_` variable to represent the current input object in the script block. Use the `$using:` 122 | scope to pass variable references to the running script block. 123 | 124 | For more information about 125 | [ForEach-Object][07]. 126 | 127 | ## Ternary operator 128 | 129 | PowerShell 7.0 introduces a ternary operator which behaves like a simplified `if-else` statement. 130 | PowerShell's ternary operator is closely modeled from the C# ternary operator syntax: 131 | 132 | ``` 133 | ? : 134 | ``` 135 | 136 | The condition-expression is always evaluated and its result converted to a **Boolean** to determine 137 | which branch is evaluated next: 138 | 139 | - The `` expression is executed if the `` expression is true 140 | - The `` expression is executed if the `` expression is false 141 | 142 | For example: 143 | 144 | ```powershell 145 | $message = (Test-Path $path) ? "Path exists" : "Path not found" 146 | ``` 147 | 148 | In this example, if the path exists, then **Path exists** is displayed. If the path doesn't exist, 149 | then **Path not found** is displayed. 150 | 151 | For more information 152 | [About If][03]. 153 | 154 | ## Pipeline chain operators 155 | 156 | PowerShell 7 implements the `&&` and `||` operators to conditionally chain pipelines. These 157 | operators are known in PowerShell as "pipeline chain operators", and are similar to AND and OR lists 158 | in shells like `bash` and `zsh`, as well as conditional processing symbols in the Windows Command 159 | Shell (`cmd.exe`). 160 | 161 | The `&&` operator executes the right-hand pipeline, if the left-hand pipeline succeeded. Conversely, 162 | the `||` operator executes the right-hand pipeline if the left-hand pipeline failed. 163 | 164 | > [!NOTE] 165 | > These operators use the `$?` and `$LASTEXITCODE` variables to determine if a pipeline failed. This 166 | > allows you to use them with native commands and not just with cmdlets or functions. 167 | 168 | Here, the first command succeeds and the second command is executed: 169 | 170 | ```powershell 171 | Write-Output 'First' && Write-Output 'Second' 172 | ``` 173 | 174 | ```Output 175 | First 176 | Second 177 | ``` 178 | 179 | Here, the first command fails, the second isn't executed: 180 | 181 | ```powershell 182 | Write-Error 'Bad' && Write-Output 'Second' 183 | ``` 184 | 185 | ```Output 186 | Write-Error: Bad 187 | ``` 188 | 189 | Here, the first command succeeds, the second command isn't executed: 190 | 191 | ```powershell 192 | Write-Output 'First' || Write-Output 'Second' 193 | ``` 194 | 195 | ```Output 196 | First 197 | ``` 198 | 199 | Here, the first command fails, so the second command is executed: 200 | 201 | ```powershell 202 | Write-Error 'Bad' || Write-Output 'Second' 203 | ``` 204 | 205 | ```Output 206 | Write-Error 'Bad' 207 | Second 208 | ``` 209 | 210 | For more information 211 | [About Pipeline Chain Operators][05]. 212 | 213 | ## Null-coalescing, assignment, and conditional operators 214 | 215 | PowerShell 7 includes Null coalescing operator `??`, Null conditional assignment `??=`, and Null 216 | conditional member access operators `?.` and `?[]`. 217 | 218 | ### Null-coalescing Operator ?? 219 | 220 | The null-coalescing operator `??` returns the value of its left-hand operand if it'sn't null. 221 | Otherwise, it evaluates the right-hand operand and returns its result. The `??` operator doesn't 222 | evaluate its right-hand operand if the left-hand operand evaluates to non-null. 223 | 224 | ```powershell 225 | $x = $null 226 | $x ?? 100 227 | 100 228 | ``` 229 | 230 | In the following example, the right-hand operand won't be evaluated: 231 | 232 | ```powershell 233 | [string] $todaysDate = '1/10/2020' 234 | $todaysDate ?? (Get-Date).ToShortDateString() 235 | 1/10/2020 236 | ``` 237 | 238 | ### Null conditional assignment operator ??= 239 | 240 | The null conditional assignment operator `??=` assigns the value of its right-hand operand to its 241 | left-hand operand only if the left-hand operand evaluates to null. The `??=` operator doesn't 242 | evaluate its right-hand operand if the left-hand operand evaluates to non-null. 243 | 244 | ```powershell 245 | $x = $null 246 | $x ??= 100 247 | $x 248 | 100 249 | ``` 250 | 251 | In the following example, the right-hand operand isn't evaluated: 252 | 253 | ```powershell 254 | [string] $todaysDate = '1/10/2020' 255 | $todaysDate ??= (Get-Date).ToShortDateString() 256 | 1/10/2020 257 | ``` 258 | 259 | ### Null conditional member access operators ?. and ?[] (Experimental) 260 | 261 | > [!NOTE] 262 | > This is an experimental feature named **PSNullConditionalOperators**. For more information, see 263 | > [Using Experimental Features][14]. 264 | 265 | A null conditional operator permits member access, `?.`, or element access, `?[]`, to its operand 266 | only if that operand evaluates to non-null; otherwise, it returns null. 267 | 268 | > [!NOTE] 269 | > Since PowerShell allows `?` to be part of the variable name, formal specification of the 270 | > variable name is required for using these operators. So it's required to use `{}` around the 271 | > variable names like `${a}` or when `?` is part of the variable name `${a?}`. 272 | 273 | In the following example, the value of the member property **Status** is returned: 274 | 275 | ```powershell 276 | $Service = Get-Service -Name 'bits' 277 | ${Service}?.status 278 | Stopped 279 | ``` 280 | 281 | The following example returns null, without trying to access the member name **Status**: 282 | 283 | ```powershell 284 | $service = $Null 285 | ${Service}?.status 286 | ``` 287 | 288 | Similarly, using `?[]`, the value of the element is returned: 289 | 290 | ```powershell 291 | $a = 1..10 292 | ${a}?[0] 293 | 1 294 | ``` 295 | 296 | And when the operand is null, the element isn't accessed and null is returned: 297 | 298 | ```powershell 299 | $a = $null 300 | ${a}?[0] 301 | ``` 302 | 303 | For more information [About_Operators][04]. 304 | 305 | ## New view ConciseView and cmdlet Get-Error 306 | 307 | PowerShell 7.0 enhances the display of error messages to improve the readability of interactive and 308 | script errors with a new default view **ConciseView**. The views are user-selectable through the 309 | preference variable `$ErrorView`. 310 | 311 | With **ConciseView**, if an error isn't from a script or parser error, then it's a single line error 312 | message: 313 | 314 | ```powershell 315 | Get-Childitem -Path c:\NotReal 316 | ``` 317 | 318 | ```Output 319 | Get-ChildItem: can't find path 'C:\NotReal' because it doesn't exist 320 | ``` 321 | 322 | If the error occurs during script execution or is a parsing error, PowerShell returns a multiline 323 | error message that contains the error, a pointer and error message showing where the error is in 324 | that line. If the terminal doesn't support ANSI color escape sequences (VT100), then colors aren't 325 | displayed. 326 | 327 | [Error display from a script][01] 328 | 329 | The default view in PowerShell 7 is **ConciseView**. The previous default view was **NormalView** 330 | and you can select this by setting the preference variable `$ErrorView`. 331 | 332 | ```powershell 333 | $ErrorView = 'NormalView' # Sets the error view to NormalView 334 | $ErrorView = 'ConciseView' # Sets the error view to ConciseView 335 | ``` 336 | 337 | > [!NOTE] 338 | > A new property **ErrorAccentColor** is added to `$Host.PrivateData` to support changing 339 | > the accent color of the error message. 340 | 341 | A new cmdlet `Get-Error` provides a complete detailed view of the fully qualified error when 342 | desired. By default the cmdlet displays the full details, including inner exceptions, of the last 343 | error that occurred. 344 | 345 | [Display from Get-Error][02] 346 | 347 | The `Get-Error` cmdlet supports input from the pipeline using the built-in variable `$Error`. 348 | `Get-Error` displays all piped errors. 349 | 350 | ```powershell 351 | $Error | Get-Error 352 | ``` 353 | 354 | The `Get-Error` cmdlet supports the **Newest** parameter, allowing you to specify how many errors 355 | from the current session you wish displayed. 356 | 357 | ```powershell 358 | Get-Error -Newest 3 # Displays the lst three errors that occurred in the session 359 | ``` 360 | 361 | For more information about [Get-Error][09]. 362 | 363 | ## New version notification 364 | 365 | PowerShell 7 uses update notifications to alert users to the existence of updates to PowerShell. 366 | Once per day, PowerShell queries an online service to determine if a newer version is available. 367 | 368 | > [!NOTE] 369 | > The update check happens during the first session in a given 24-hour period. For performance 370 | > reasons, the update check starts 3 seconds after the session begins. The notification is shown 371 | > only on the start of subsequent sessions. 372 | 373 | By default, PowerShell subscribes to one of two different notification channels depending on its 374 | version/branch. Supported, Generally Available (GA) versions of PowerShell only return notifications 375 | for updated GA releases. Preview and Release Candidate (RC) releases notify of updates to preview, 376 | RC, and GA releases. 377 | 378 | The update notification behavior can be changed using the `$Env:POWERSHELL_UPDATECHECK` environment 379 | variable. The following values are supported: 380 | 381 | - **Default** is the same as not defining `$Env:POWERSHELL_UPDATECHECK` 382 | - GA releases notify of updates to GA releases 383 | - Preview/RC releases notify of updates to GA and preview releases 384 | - **Off** turns off the update notification feature 385 | - **LTS** only notifies of updates to long-term-servicing (LTS) GA releases 386 | 387 | > [!NOTE] 388 | > The environment variable `$Env:POWERSHELL_UPDATECHECK` doesn't exist until it's set for 389 | > the first time. 390 | 391 | To set the version notification for `LTS` releases only: 392 | 393 | ```powershell 394 | $Env:POWERSHELL_UPDATECHECK = 'LTS' 395 | ``` 396 | 397 | To set the version notification to the `Default` behavior: 398 | 399 | ```powershell 400 | $Env:POWERSHELL_UPDATECHECK = 'Default' 401 | ``` 402 | 403 | For more information [About Update Notifications][06]. 404 | 405 | ## New DSC Resource support with Invoke-DSCResource (Experimental) 406 | 407 | > [!NOTE] 408 | > This is an experimental feature named **PSDesiredStateConfiguration.InvokeDscResource**. For more 409 | > information, see [Using Experimental Features][14]. 410 | 411 | The `Invoke-DscResource` cmdlet runs a method of a specified PowerShell Desired State Configuration 412 | (DSC) resource. 413 | 414 | This cmdlet invokes a DSC resource directly, without creating a configuration document. Using this 415 | cmdlet, configuration management products can manage Windows or Linux by using DSC resources. This 416 | cmdlet also enables debugging of resources when the DSC engine is running with debugging enabled. 417 | 418 | This command invokes the **Set** method of a resource named **WindowsProcess** and provides the 419 | mandatory **Path** and **Arguments** properties to start the specified Windows process. 420 | 421 | ```powershell 422 | Invoke-DscResource -Name WindowsProcess -Method Set -ModuleName PSDesiredStateConfiguration -Property @{ 423 | Path = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' 424 | Arguments = '' 425 | } 426 | ``` 427 | 428 | For more information about [Invoke-DSCResource][10]. 429 | 430 | ## Breaking Changes and Improvements 431 | 432 | ### Breaking Changes 433 | 434 | - Make update notification support LTS and default channels (#11132) 435 | - Update Test-Connection to work more like the one in Windows PowerShell (#10697) (Thanks @vexx32!) 436 | - Preserve $? for ParenExpression, SubExpression and ArrayExpression (#11040) 437 | - Set working directory to current directory in Start-Job (#10920) (Thanks @iSazonov!) 438 | - Make $PSCulture consistently reflect in-session culture changes (#10138) (Thanks @iSazonov!) 439 | 440 | ### Engine Updates and Fixes 441 | 442 | - Improvements in breakpoint APIs for remote scenarios (#11312) 443 | - Fix PowerShell class definition leaking into another Runspace (#11273) 444 | - Fix a regression in formatting caused by the FirstOrDefault primitive added in 7.0.0-Preview1 445 | (#11258) 446 | - Additional Microsoft Modules to track in PS7 Telemetry (#10751) 447 | - Make approved features non-experimental (#11303) 448 | - Update ConciseView to use TargetObject if applicable (#11075) 449 | - Fix NullReferenceException in CompletionCompleters public methods (#11274) 450 | - Fix apartment thread state check on non-Windows platforms (#11301) 451 | - Update setting PSModulePath to concatenate the process and machine environment variables (#11276) 452 | - Bump .NET Core to 3.1.0 (#11260) 453 | - Fix detection of $PSHOME in front of $env:PATH (#11141) 454 | - Allow pwsh to inherit $env:PSModulePath and enable powershell.exe to start correctly (#11057) 455 | - Move to .NET Core 3.1 preview 1 (#10798) 456 | - Refactor reparse tag checks in file system provider (#10431) (Thanks @iSazonov!) 457 | - Replace CR and new line with a 0x23CE character in script logging (#10616) 458 | - Fix a resource leak by unregistering the event handler from AppDomain.CurrentDomain.ProcessExit 459 | (#10626) 460 | - Add support to ActionPreference.Break to break into debugger when Debug, Error, Information, 461 | Progress, Verbose or Warning messages are generated (#8205) (Thanks @KirkMunro!) 462 | - Enable starting control panel add-ins within PowerShell without specifying .CPL extension. (#9828) 463 | - Support negative numbers in -split operator (#8960) (Thanks @ece-jacob-scott!) 464 | 465 | ### General Cmdlet Updates and Fixes 466 | 467 | - Fix for issue on Raspbian for setting date of file changes in UnixStat Experimental Feature 468 | (#11313) 469 | - Add -AsPlainText to ConvertFrom-SecureString (#11142) 470 | - Added WindowsPS version check for WinCompat (#11148) 471 | - Fix error-reporting in some WinCompat scenarios (#11259) 472 | - Add native binary resolver (#11032) (Thanks @iSazonov!) 473 | - Update calculation of char width to respect CJK chars correctly (#11262) 474 | - Add Unblock-File for macOS (#11137) 475 | - Fix regression in Get-PSCallStack (#11210) (Thanks @iSazonov!) 476 | - Remove autoloading of the ScheduledJob module when using Job cmdlets (#11194) 477 | - Add OutputType to Get-Error cmdlet and preserve original typenames (#10856) 478 | - Fix null reference in SupportsVirtualTerminal property (#11105) 479 | - Add limit check in Get-WinEvent (#10648) (Thanks @iSazonov!) 480 | - Fix command runtime so StopUpstreamCommandsException doesn't get populated in -ErrorVariable 481 | (#10840) 482 | - Set the output encoding to [Console]::OutputEncoding for native commands (#10824) 483 | - Support multi-line code blocks in examples (#10776) (Thanks @Greg-Smulko!) 484 | - Add Culture parameter to Select-String cmdlet (#10943) (Thanks @iSazonov!) 485 | - Fix Start-Job working directory path with trailing backslash (#11041) 486 | - ConvertFrom-Json: Unwrap collections by default (#10861) (Thanks @danstur!) 487 | - Use case-sensitive Hashtable for Group-Object cmdlet with -CaseSensitive and -AsHashtable switches 488 | (#11030) (Thanks @vexx32!) 489 | - Handle exception if enumerating files fails when rebuilding path to have correct casing (#11014) 490 | - Fix ConciseView to show Activity instead of myCommand (#11007) 491 | - Allow web cmdlets to ignore HTTP error statuses (#10466) (Thanks @vdamewood!) 492 | - Fix piping of more than one CommandInfo to Get-Command (#10929) 493 | - Add back Get-Counter cmdlet for Windows (#10933) 494 | - Make ConvertTo-Json treat [AutomationNull]::Value and [NullString]::Value as $null (#10957) 495 | - Remove brackets from ipv6 address for SSH remoting (#10968) 496 | - Fix crash if command sent to pwsh is just whitespace (#10977) 497 | - Added cross-platform Get-Clipboard and Set-Clipboard (#10340) 498 | - Fix setting original path of filesystem object to not have extra trailing slash (#10959) 499 | - Support $null for ConvertTo-Json (#10947) 500 | - Add back Out-Printer command on Windows (#10906) 501 | - Fix Start-Job -WorkingDirectory with whitespace (#10951) 502 | - Return default value when getting null for a setting in PSConfiguration.cs (#10963) (Thanks 503 | @iSazonov!) 504 | - Handle IO exception as non-terminating (#10950) 505 | - Add GraphicalHost assembly to enable Out-GridView, Show-Command, and Get-Help -ShowWindow (#10899) 506 | - Take ComputerName via pipeline in Get-HotFix (#10852) (Thanks @kvprasoon!) 507 | - Fix tab completion for parameters so that it shows common parameters as available (#10850) 508 | - Fix GetCorrectCasedPath() to first check if any system file entries is returned before calling 509 | First() (#10930) 510 | - Set working directory to current directory in Start-Job (#10920) (Thanks @iSazonov!) 511 | - Change TabExpansion2 to not require -CursorColumn and treat as $InputScript.Length (#10849) 512 | - Handle case where Host may not return Rows or Columns of screen (#10938) 513 | - Fix use of accent colors for hosts that don't support them (#10937) 514 | - Add back Update-List command (#10922) 515 | - Update FWLink Id for Clear-RecycleBin (#10925) 516 | - During tab completion, skip file if can't read file attributes (#10910) 517 | - Add back Clear-RecycleBin for Windows (#10909) 518 | - Add `$env:__SuppressAnsiEscapeSequences` to control whether to have VT escape sequence in output 519 | (#10814) 520 | - Add -NoEmphasize parameter to colorize Select-String output (#8963) (Thanks @derek-xia!) 521 | - Add back Get-HotFix cmdlet (#10740) 522 | - Make Add-Type usable in applications that host PowerShell (#10587) 523 | - Use more effective evaluation order in LanguagePrimitives.IsNullLike() (#10781) (Thanks @vexx32!) 524 | - Improve handling of mixed-collection piped input and piped streams of input in Format-Hex (#8674) 525 | (Thanks @vexx32!) 526 | - Use type conversion in SSHConnection hashtables when value doesn't match expected type (#10720) 527 | (Thanks @SeeminglyScience!) 528 | - Fix Get-Content -ReadCount 0 behavior when -TotalCount is set (#10749) (Thanks @eugenesmlv!) 529 | - Reword access denied error message in Get-WinEvent (#10639) (Thanks @iSazonov!) 530 | - Enable tab completion for variable assignment that's enum or type constrained (#10646) 531 | - Remove unused SourceLength remoting property causing formatting issues (#10765) 532 | - Add -Delimiter parameter to ConvertFrom-StringData (#10665) (Thanks @steviecoaster!) 533 | - Add positional parameter for ScriptBlock when using Invoke-Command with SSH (#10721) (Thanks 534 | @machgo!) 535 | - Show line context information if multiple lines but no script name for ConciseView (#10746) 536 | - Add support for \\wsl$\ paths to file system provider (#10674) 537 | - Add the missing token text for TokenKind.QuestionMark in parser (#10706) 538 | - Set current working directory of each ForEach-Object -Parallel running script to the same location 539 | as the calling script. (#10672) 540 | - Replace api-ms-win-core-file-l1-2-2.dll with Kernell32.dll for FindFirstStreamW and 541 | FindNextStreamW APIs (#10680) (Thanks @iSazonov!) 542 | - Tweak help formatting script to be more StrictMode tolerant (#10563) 543 | - Add -SecurityDescriptorSDDL parameter to New-Service (#10483) (Thanks @kvprasoon!) 544 | - Remove informational output, consolidate ping usage in Test-Connection (#10478) (Thanks @vexx32!) 545 | - Read special reparse points without accessing them (#10662) (Thanks @iSazonov!) 546 | - Direct Clear-Host output to terminal (#10681) (Thanks @iSazonov!) 547 | - Add back newline for grouping with Format-Table and -Property (#10653) 548 | - Remove [ValidateNotNullOrEmpty] from -InputObject on Get-Random to allow empty string (#10644) 549 | - Make suggestion system string distance algorithm case-insensitive (#10549) (Thanks @iSazonov!) 550 | - Fix null reference exception in ForEach-Object -Parallel input processing (#10577) 551 | - Add PowerShell group policy definitions (#10468) 552 | - Update console host to support XTPUSHSGR/XTPOPSGR VT control sequences that are used in 553 | composability scenarios. (#10208) 554 | - Add WorkingDirectory parameter to Start-Job (#10324) (Thanks @davinci26!) 555 | - Remove the event handler that was causing breakpoint changes to be erroneously replicated to the 556 | host runspace debugger (#10503) (Thanks @KirkMunro!) 557 | - Replace api-ms-win-core-job-12-1-0.dll with Kernell32.dll in 558 | Microsoft.PowerShell.Commands.NativeMethods P/Invoke API(#10417) (Thanks @iSazonov!) 559 | - Fix wrong output for New-Service in variable assignment and -OutVariable (#10444) (Thanks 560 | @kvprasoon!) 561 | - Fix global tool issues around exit code, command line parameters and path with spaces (#10461) 562 | - Fix recursion into OneDrive - change FindFirstFileEx() to use SafeFindHandle type (#10405) 563 | - Skip auto-loading PSReadLine on Windows if the NVDA screen reader is active (#10385) 564 | - Increase built-with-PowerShell module versions to 7.0.0.0 (#10356) 565 | - Add throwing an error in Add-Type if a type with the same name already exists (#9609) (Thanks 566 | @iSazonov!) 567 | 568 | ### Performance 569 | 570 | - Avoid using closure in Parser.SaveError (#11006) 571 | - Improve the caching when creating new Regex instances (#10657) (Thanks @iSazonov!) 572 | - Improve processing of the PowerShell built-in type data from types.ps1xml, typesV3.ps1xml and 573 | GetEvent.types.ps1xml (#10898) 574 | - Update PSConfiguration.ReadValueFromFile to make it faster and more memory efficient (#10839) 575 | - Add minor performance improvements for runspace initialization (#10569) (Thanks @iSazonov!) 576 | - Make ForEach-Object faster for its commonly used scenarios (#10454) and fix ForEach-Object 577 | -Parallel performance problem with many runspaces (#10455) 578 | 579 | ### Code Cleanup 580 | 581 | - Change comment and element text to meet Microsoft standards (#11304) 582 | - Cleanup style issues in Compiler.cs (#10368) (Thanks @iSazonov!) 583 | - Remove the unused type converter for CommaDelimitedStringCollection (#11000) (Thanks @iSazonov!) 584 | - Cleanup style in InitialSessionState.cs (#10865) (Thanks @iSazonov!) 585 | - Code clean up for PSSession class (#11001) 586 | - Remove the not-working 'run Update-Help from Get-Help when Get-Help runs for the first time' 587 | feature (#10974) 588 | - Fix style issues (#10998) (Thanks @iSazonov!) 589 | - Cleanup: use the built-in type alias (#10882) (Thanks @iSazonov!) 590 | - Remove the unused setting key ConsolePrompting and avoid unnecessary string creation when querying 591 | ExecutionPolicy setting (#10985) 592 | - Disable update notification check for daily builds (#10903) (Thanks @bergmeister!) 593 | - Reinstate debugging API lost in #10338 (#10808) 594 | - Remove WorkflowJobSourceAdapter reference that's no longer used (#10326) (Thanks @KirkMunro!) 595 | - Cleanup COM interfaces in jump list code by fixing PreserveSig attributes (#9899) (Thanks 596 | @weltkante!) 597 | - Add a comment describing why -ia isn't the alias for -InformationAction common parameter (#10703) 598 | (Thanks @KirkMunro!) 599 | - Rename InvokeCommandCmdlet.cs to InvokeExpressionCommand.cs (#10659) (Thanks @kilasuit!) 600 | - Add minor code cleanups related to update notifications (#10698) 601 | - Remove deprecated workflow logic from the remoting setup scripts (#10320) (Thanks @KirkMunro!) 602 | - Update help format to use proper case (#10678) (Thanks @tnieto88!) 603 | - Clean up CodeFactor style issues coming in commits for the last month (#10591) (Thanks @iSazonov!) 604 | - Fix typo in description of PSTernaryOperator experimental feature (#10586) (Thanks @bergmeister!) 605 | - Convert ActionPreference.Suspend enumeration value into a non-supported, reserved state, and 606 | remove restriction on using ActionPreference.Ignore in preference variables (#10317) (Thanks 607 | @KirkMunro!) 608 | - Replace ArrayList with List\ to get more readable and reliable code without changing 609 | functionality (#10333) (Thanks @iSazonov!) 610 | - Make code style fixes to TestConnectionCommand (#10439) (Thanks @vexx32!) 611 | - Cleanup AutomationEngine and remove extra SetSessionStateDrive method call (#10416) (Thanks 612 | @iSazonov!) 613 | - Rename default ParameterSetName back to Delimiter for ConvertTo-Csv and ConvertFrom-Csv (#10425) 614 | 615 | ### Tools 616 | 617 | - Add default setting for the SDKToUse property so that it builds in VS (#11085) 618 | - Install-Powershell.ps1: Add parameter to use MSI installation (#10921) (Thanks @MJECloud!) 619 | - Add basic examples for install-powershell.ps1 (#10914) (Thanks @kilasuit!) 620 | - Make Install-PowerShellRemoting.ps1 handle empty string in PowerShellHome parameter (#10526) 621 | (Thanks @Orca88!) 622 | - Switch from /etc/lsb-release to /etc/os-release in install-powershell.sh (#10773) (Thanks 623 | @Himura2la!) 624 | - Check pwsh.exe and pwsh in daily version on Windows (#10738) (Thanks @centreboard!) 625 | - Remove unneeded tap in installpsh-osx.sh (#10752) 626 | - Update install-powershell.ps1 to check for already installed daily build (#10489) 627 | 628 | ### Tests 629 | 630 | - Make unreliable DSC test pending (#11131) 631 | - Fix stringdata test to correctly validate keys of hashtables (#10810) 632 | - Unload test modules (#11061) (Thanks @iSazonov!) 633 | - Increase time between retries of testing URL (#11015) 634 | - Update tests to accurately describe test actions. (#10928) (Thanks @romero126!) 635 | - Temporary skip the flaky test TestAppDomainProcessExitEvenHandlerNotLeaking (#10827) 636 | - Make the event handler leaking test stable (#10790) 637 | - Sync capitalization in CI YAML (#10767) (Thanks @RDIL!) 638 | - Add test for the event handler leaking fix (#10768) 639 | - Add Get-ChildItem test (#10507) (Thanks @iSazonov!) 640 | - Replace ambiguous language for tests from switch to parameter for accuracy (#10666) (Thanks 641 | @romero126!) 642 | - Add experimental check to ForEach-Object -Parallel tests (#10354) (Thanks @KirkMunro!) 643 | - Update tests for Alpine validation (#10428) 644 | 645 | ### Build and Package Improvements 646 | 647 | - Fix Nuget package signing for Coordinated Package build (#11316) 648 | - Update dependencies from PowerShell Gallery and NuGet (#11323) 649 | - Bump Microsoft.ApplicationInsights from 2.11.0 to 2.12.0 (#11305) 650 | - Bump Microsoft.CodeAnalysis.CSharp from 3.3.1 to 3.4.0 (#11265) 651 | - Updates packages for Debian 10 and 11 (#11236) 652 | - Only enable experimental features prior to RC (#11162) 653 | - Update macOS minimum version (#11163) 654 | - Bump NJsonSchema from 10.0.27 to 10.0.28 (#11170) 655 | - Updating links in README.md and metadata.json for Preview.5 (#10854) 656 | - Select the files for compliance tests which are owned by PowerShell (#10837) 657 | - Allow win7x86 msix package to build. (Internal 10515) 658 | - Allow semantic versions to be passed to NormalizeVersion function (#11087) 659 | - Bump .NET core framework to 3.1-preview.3 (#11079) 660 | - Bump PSReadLine from 2.0.0-beta5 to 2.0.0-beta6 in /src/Modules (#11078) 661 | - Bump Newtonsoft.Json from 12.0.2 to 12.0.3 (#11037) (#11038) 662 | - Add Debian 10, 11 and CentOS 8 packages (#11028) 663 | - Upload Build-Info Json file with the ReleaseDate field (#10986) 664 | - Bump .NET core framework to 3.1-preview.2 (#10993) 665 | - Enable build of x86 MSIX package (#10934) 666 | - Update the dotnet SDK install script URL in build.psm1 (#10927) 667 | - Bump Markdig.Signed from 0.17.1 to 0.18.0 (#10887) 668 | - Bump ThreadJob from 2.0.1 to 2.0.2 (#10886) 669 | - Update AppX Manifest and Packaging module to conform to MS Store requirements (#10878) 670 | - Update package reference for PowerShell SDK to preview.5 (Internal 10295) 671 | - Update ThirdPartyNotices.txt (#10834) 672 | - Bump Microsoft.PowerShell.Native to 7.0.0-preview.3 (#10826) 673 | - Bump Microsoft.ApplicationInsights from 2.10.0 to 2.11.0 (#10608) 674 | - Bump NJsonSchema from 10.0.24 to 10.0.27 (#10756) 675 | - Add MacPorts support to the build system (#10736) (Thanks @Lucius-Q-User!) 676 | - Bump PackageManagement from 1.4.4 to 1.4.5 (#10728) 677 | - Bump NJsonSchema from 10.0.23 to 10.0.24 (#10635) 678 | - Add environment variable to differentiate client/server telemetry in MSI (#10612) 679 | - Bump PSDesiredStateConfiguration from 2.0.3 to 2.0.4 (#10603) 680 | - Bump Microsoft.CodeAnalysis.CSharp from 3.2.1 to 3.3.1 (#10607) 681 | - Update to .Net Core 3.0 RTM (#10604) (Thanks @bergmeister!) 682 | - Update MSIX packaging so the version to Windows Store requirements (#10588) 683 | - Bump PowerShellGet version from 2.2 to 2.2.1 (#10382) 684 | - Bump PackageManagement version from 1.4.3 to 1.4.4 (#10383) 685 | - Update README.md and metadata.json for 7.0.0-preview.4 (Internal 10011) 686 | - Upgrade .Net Core 3.0 version from Preview 9 to RC1 (#10552) (Thanks @bergmeister!) 687 | - Fix ExperimentalFeature list generation (Internal 9996) 688 | - Bump PSReadLine version from 2.0.0-beta4 to 2.0.0-beta5 (#10536) 689 | - Fix release build script to set release tag 690 | - Update version of Microsoft.PowerShell.Native to 7.0.0-preview.2 (#10519) 691 | - Upgrade to Netcoreapp3.0 preview9 (#10484) (Thanks @bergmeister!) 692 | - Make sure the daily coordinated build, knows it's a daily build (#10464) 693 | - Update the combined package build to release the daily builds (#10449) 694 | - Remove appveyor reference (#10445) (Thanks @RDIL!) 695 | - Bump NJsonSchema version from 10.0.22 to 10.0.23 (#10421) 696 | - Remove the deletion of linux-x64 build folder because some dependencies for Alpine need it (#10407) 697 | 698 | ### Documentation and Help Content 699 | 700 | - Refactor change logs into one log per release (#11165) 701 | - Fix FWLinks for PowerShell 7 online help documents (#11071) 702 | - Update CONTRIBUTING.md (#11096) (Thanks @mklement0!) 703 | - Fix installation doc links in README.md (#11083) 704 | - Adds examples to install-powershell.ps1 script (#11024) (Thanks @kilasuit!) 705 | - Fix to Select-String emphasis and Import-DscResource in CHANGELOG.md (#10890) 706 | - Remove the stale link from powershell-beginners-guide.md (#10926) 707 | - Merge stable and servicing change logs (#10527) 708 | - Update used .NET version in build docs (#10775) (Thanks @Greg-Smulko!) 709 | - Replace links from MSDN to Microsoft Learn in powershell-beginners-guide.md (#10778) (Thanks @iSazonov!) 710 | - Fix broken DSC overview link (#10702) 711 | - Update Support_Question.md to link to Stack Overflow as another community resource (#10638) 712 | (Thanks @mklement0!) 713 | - Add processor architecture to distribution request template (#10661) 714 | - Add new PowerShell MoL book to learning PowerShell docs (#10602) 715 | - Update README.md and metadata for v6.1.6 and v6.2.3 releases (#10523) 716 | - Fix a typo in README.md (#10465) (Thanks @vedhasp!) 717 | - Add a reference to PSKoans module to Learning Resources documentation (#10369) (Thanks @vexx32!) 718 | - Update README.md and metadata.json for 7.0.0-preview.3 (#10393) 719 | 720 | 721 | 722 | [01]: ./media/What-s-New-in-PowerShell-70/myscript-error.png 723 | [02]: ./media/What-s-New-in-PowerShell-70/myscript-geterror.png 724 | [03]: /powershell/module/microsoft.powershell.core/about/about_if 725 | [04]: /powershell/module/microsoft.powershell.core/about/about_operators?view=powershell-7&preserve-view=true 726 | [05]: /powershell/module/microsoft.powershell.core/about/about_pipeline_chain_operators?view=powershell-7&preserve-view=true 727 | [06]: /powershell/module/microsoft.powershell.core/about/about_update_notifications 728 | [07]: /powershell/module/microsoft.powershell.core/foreach-object?view=powershell-7&preserve-view=true 729 | [08]: /powershell/module/microsoft.powershell.core/import-module?view=powershell-7&preserve-view=true 730 | [09]: /powershell/module/microsoft.powershell.utility/get-error?view=powershell-7&preserve-view=true 731 | [10]: /powershell/module/psdesiredstateconfiguration/invoke-dscresource?view=powershell-7&preserve-view=true 732 | [11]: /powershell/scripting/install/installing-powershell-core-on-linux 733 | [12]: /powershell/scripting/install/installing-powershell-core-on-macos 734 | [13]: /powershell/scripting/install/installing-powershell-core-on-windows 735 | [14]: /powershell/scripting/learn/experimental-features 736 | [15]: /powershell/scripting/learn/remoting/ssh-remoting-in-powershell-core 737 | [16]: /powershell/scripting/powershell-support-lifecycle 738 | [17]: https://aka.ms/PSModuleCompat 739 | [18]: https://aur.archlinux.org/packages/powershell/ 740 | [19]: https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG/7.0.md 741 | -------------------------------------------------------------------------------- /Microsoft.PowerShell.WhatsNew/relnotes/What-s-New-in-PowerShell-71.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: New features and changes released in PowerShell 7.1 3 | ms.date: 10/04/2021 4 | title: What's New in PowerShell 7.1 5 | --- 6 | 7 | # What's New in PowerShell 7.1 8 | 9 | On November 11, 2020 we 10 | [announced](https://devblogs.microsoft.com/powershell/announcing-powershell-7-1/) the general 11 | availability of PowerShell 7.1. Building on the foundation established in PowerShell 7.0, our 12 | efforts focused on community issues and include a number of improvements and fixes. We are committed 13 | to ensuring that PowerShell remains a stable and performant platform. 14 | 15 | PowerShell 7.1 includes the following features, updates, and breaking changes. 16 | 17 | - PSReadLine 2.1.0, which includes Predictive IntelliSense 18 | - PowerShell 7.1 has been published to the Microsoft Store 19 | - Installer packages updated for new OS versions with support for ARM64 20 | - 4 new experimental features and 2 experimental features promoted to mainstream 21 | - Several breaking changes to improve usability 22 | 23 | For a complete list of changes, see the 24 | [CHANGELOG](https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG/7.1.md) in the GitHub 25 | repository. 26 | 27 | ## PSReadLine 2.1.0 28 | 29 | PowerShell 7.1 also includes PSReadLine 2.1.0. This version includes Predictive IntelliSense. For 30 | more information about the Predictive IntelliSense feature, see the 31 | [announcement](https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/) 32 | in the PowerShell blog. 33 | 34 | ## Microsoft Store installer package 35 | 36 | PowerShell 7.1 has been published to the Microsoft Store. You can find the PowerShell release on the 37 | [Microsoft Store](https://www.microsoft.com/store/apps/9MZ1SNWT0N5D) website or in the 38 | Store application in Windows. 39 | 40 | Benefits of the Microsoft Store package: 41 | 42 | - Automatic updates built right into Windows 43 | - Integrates with other software distribution mechanisms like Intune and SCCM 44 | 45 | > [!NOTE] 46 | > Any system-level configuration settings stored in `$PSHOME` cannot be modified. This includes the 47 | > WSMAN configuration. This prevents remote sessions from connecting to Store-based installs of 48 | > PowerShell. User-level configurations and SSH remoting are supported. 49 | 50 | ## Other installers 51 | 52 | For more up-to-date information about supported operating systems and support lifecycle, see the 53 | [PowerShell Support Lifecycle](/powershell/scripting/powershell-support-lifecycle). 54 | 55 | Check the installation instructions for your preferred operating system: 56 | 57 | - [Windows](/powershell/scripting/install/installing-powershell-core-on-windows) 58 | - [macOS](/powershell/scripting/install/installing-powershell-core-on-macos) 59 | - [Linux](/powershell/scripting/install/installing-powershell-core-on-linux) 60 | 61 | Additionally, PowerShell 7.1 supports ARM32 and ARM64 flavors of Debian, Ubuntu, and ARM64 Alpine 62 | Linux. 63 | 64 | While not officially supported, the community has also provided packages for 65 | [Arch](https://aur.archlinux.org/packages/powershell/) and Kali Linux. 66 | 67 | > [!NOTE] 68 | > Debian 10+, CentOS 8+, Ubuntu 20.04, Alpine and Arm currently do not support WinRM remoting. For 69 | > details on setting up SSH-based remoting, see 70 | > [PowerShell Remoting over SSH](/powershell/scripting/learn/remoting/ssh-remoting-in-powershell-core). 71 | 72 | ## Experimental Features 73 | 74 | For more information about the Experimental Features, see [Using Experimental Features](../learn/experimental-features.md). 75 | 76 | The following experimental features are now mainstream features in this release: 77 | 78 | - [PSNullConditionalOperators](../learn/experimental-features.md#psnullconditionaloperators) 79 | - [PSUnixFileStat](../learn/experimental-features.md#psunixfilestat) 80 | 81 | The following experimental features were added in this release: 82 | 83 | - [Microsoft.PowerShell.Utility.PSManageBreakpointsInRunspace](../learn/experimental-features.md#microsoftpowershellutilitypsmanagebreakpointsinrunspace) 84 | - PowerShell 7.1 extends this experimental feature to add the **Runspace** parameter to all 85 | `*-PSBreakpoint` cmdlets. The **Runspace** parameter specifies a **Runspace** object to interact 86 | with breakpoints in the specified runspace. 87 | 88 | - [PSNativePSPathResolution](../learn/experimental-features.md#psnativepspathresolution) - This 89 | feature allows you to pass PowerShell provider paths to native commands that don't support 90 | PowerShell path syntax. 91 | 92 | - [PSCultureInvariantReplaceOperator](../learn/experimental-features.md#pscultureinvariantreplaceoperator) - 93 | When the left-hand operand in a `-replace` operator statement is not a string, that operand is 94 | converted to a string. With the feature enabled, the conversion does not use Culture settings for 95 | string conversion. 96 | 97 | - [PSSubsystemPluginModel](../learn/experimental-features.md#pssubsystempluginmodel) lays the 98 | groundwork to support future Predictive IntelliSense plug-ins. 99 | 100 | ## Breaking Changes and Improvements 101 | 102 | - String comparison behavior changed in .NET 5.0 103 | 104 | PowerShell 7.1 is built on .NET 5.0, which introduced the following breaking change: 105 | 106 | - [Behavior changes when comparing strings on .NET 5+](/dotnet/standard/base-types/string-comparison-net-5-plus) 107 | 108 | As of .NET 5.0, culture invariant string comparisons ignore non-printing control characters. 109 | 110 | For example, the following two strings are considered to be identical: 111 | 112 | ```powershell 113 | # Escape sequence "`a" is Ctrl-G or [char]7 114 | 'Food' -eq "Foo`ad" 115 | ``` 116 | 117 | ```Output 118 | True 119 | ``` 120 | 121 | - Fix `$?` to not be `$false` when native command writes to `stderr` 122 | ([#13395](https://github.com/PowerShell/PowerShell/pull/13395)) 123 | 124 | It is common for native commands to write to `stderr` without intending to indicate a failure. 125 | With this change `$?` is set to `$false` only when the native command also has a non-zero exit 126 | code. This change is unrelated to the experimental feature `PSNotApplyErrorActionToStderr`. 127 | 128 | - Make `$ErrorActionPreference` not affect `stderr` output of native commands 129 | ([#13361](https://github.com/PowerShell/PowerShell/pull/13361)) 130 | 131 | It is common for native commands to write to `stderr` without intending to indicate a failure. 132 | With this change, `stderr` output is still captured in **ErrorRecord** objects, but the runtime no 133 | longer applies `$ErrorActionPreference` if the **ErrorRecord** comes from a native command. 134 | 135 | - Rename `-FromUnixTime` to `-UnixTimeSeconds` on `Get-Date` to allow Unix time input 136 | ([#13084](https://github.com/PowerShell/PowerShell/pull/13084)) (Thanks @aetos382!) 137 | 138 | The `-FromUnixTime` parameter was added during 7.1-preview.2. The parameter was renamed to better 139 | match the data type. This parameter takes an integer value that represents in seconds since 140 | January 1, 1970, 0:00:00. 141 | 142 | This example converts a Unix time (represented by the number of seconds since 1970-01-01 0:00:00) 143 | to DateTime. 144 | 145 | ```powershell 146 | Get-Date -UnixTimeSeconds 1577836800 147 | 148 | Wednesday, January 01, 2020 12:00:00 AM 149 | ``` 150 | 151 | - Allow explicitly specified named parameter to supersede the same one from hashtable splatting 152 | (#13162) 153 | 154 | With this change, the named parameters from splatting are moved to the end of the parameter list 155 | so that they are bound after all explicitly specified named parameters are bound. Parameter 156 | binding for simple functions doesn't throw an error when a specified named parameter cannot be 157 | found. Unknown named parameters are bound to the `$args` parameter of the simple function. Moving 158 | splatting to the end of the argument list changes the order the parameters appears in `$args`. 159 | 160 | For example: 161 | 162 | ```powershell 163 | function SimpleTest { 164 | param( 165 | $Name, 166 | $Path 167 | ) 168 | "Name: $Name; Path: $Path; Args: $args" 169 | } 170 | ``` 171 | 172 | In the previous behavior, **MyPath** is not bound to `-Path` because it's the third argument in 173 | the argument list. ## So it ends up being stuffed into '$args' along with `Blah = "World"` 174 | 175 | ```powershell 176 | PS> $hash = @{ Name = "Hello"; Blah = "World" } 177 | PS> SimpleTest @hash "MyPath" 178 | Name: Hello; Path: ; Args: -Blah: World MyPath 179 | ``` 180 | 181 | With this change, the arguments from `@hash` are moved to the end of the argument list. **MyPath** 182 | becomes the first argument in the list, so it is bound to `-Path`. 183 | 184 | ```powershell 185 | PS> SimpleTest @hash "MyPath" 186 | Name: Hello; Path: MyPath; Args: -Blah: World 187 | ``` 188 | 189 | - Make the switch parameter `-Qualifier` not positional for `Split-Path` 190 | ([#12960](https://github.com/PowerShell/PowerShell/pull/12960)) (Thanks @yecril71pl!) 191 | 192 | - Resolve the working directory as literal path for `Start-Process` when it's not specified 193 | ([#11946](https://github.com/PowerShell/PowerShell/pull/11946)) (Thanks @NoMoreFood!) 194 | 195 | - Make `-OutFile` parameter in web cmdlets to work like `-LiteralPath` 196 | ([#11701](https://github.com/PowerShell/PowerShell/pull/11701)) (Thanks @iSazonov!) 197 | 198 | - Fix string parameter binding for `BigInteger` numeric literals 199 | ([#11634](https://github.com/PowerShell/PowerShell/pull/11634)) (Thanks @vexx32!) 200 | 201 | - On Windows, `Start-Process` creates a process environment with all the environment variables from 202 | current session, using `-UseNewEnvironment` creates a new default process environment 203 | ([#10830](https://github.com/PowerShell/PowerShell/pull/10830)) (Thanks @iSazonov!) 204 | 205 | - Do not wrap return result in `PSObject` when converting a `ScriptBlock` to a delegate 206 | ([#10619](https://github.com/PowerShell/PowerShell/pull/10619)) 207 | 208 | When a `ScriptBlock` is converted to a delegate type to be used in C# context, wrapping the result 209 | in a `PSObject` brings unneeded troubles: 210 | 211 | - When the value is converted to the delegate return type, the `PSObject` essentially gets 212 | unwrapped. So the `PSObject` is unneeded. 213 | - When the delegate return type is `object`, it gets wrapped in a `PSObject` making it hard to 214 | work with in C# code. 215 | 216 | After this change, the returned object is the underlying object. 217 | 218 | 219 | -------------------------------------------------------------------------------- /Microsoft.PowerShell.WhatsNew/relnotes/What-s-New-in-PowerShell-72.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: What's New in PowerShell 7.2 3 | description: New features and changes released in PowerShell 7.2 4 | ms.date: 01/20/2023 5 | --- 6 | 7 | # What's New in PowerShell 7.2 8 | 9 | PowerShell 7.2 is the next Long Term Servicing (LTS) release is built on .NET 6.0. 10 | 11 | PowerShell 7.2 includes the following features, updates, and breaking changes. 12 | 13 | - New universal installer packages for most supported Linux distributions 14 | - Microsoft Update support on Windows 15 | - 2 new experimental features 16 | - Improved native command argument passing support 17 | - ANSI FileInfo color support 18 | - Improved Tab Completions 19 | - PSReadLine 2.1 with Predictive IntelliSense 20 | - 7 experimental features promoted to mainstream and 1 removed 21 | - Separating DSC from PowerShell 7 to enable future improvements 22 | - Several breaking changes to improve usability 23 | 24 | For a complete list of changes, see the [Change Log][11] in the GitHub repository. 25 | 26 | ## Installation updates 27 | 28 | Check the installation instructions for your preferred operating system: 29 | 30 | - [Windows][09] 31 | - [macOS][08] 32 | - [Linux][07] 33 | 34 | Additionally, PowerShell 7.2 supports ARM64 versions of Windows and macOS and ARM32 and ARM64 35 | versions of Debian and Ubuntu. 36 | 37 | For up-to-date information about supported operating systems and support lifecycle, see the 38 | [PowerShell Support Lifecycle][10]. 39 | 40 | ### New universal install packages for Linux distributions 41 | 42 | Previously, we created separate installer packages for each supported version of CentOS, RHEL, 43 | Debian, and Ubuntu. The universal installer package combines eight different packages into one, 44 | making installation on Linux simpler. The universal package installs the necessary dependencies for 45 | the target distribution and creates the platform-specific changes to make PowerShell work. 46 | 47 | ### Microsoft Update support for Windows 48 | 49 | PowerShell 7.2 add support for Microsoft Update. When you enable this feature, you'll get the latest 50 | PowerShell 7 updates in your traditional Windows Update (WU) management flow, whether that's with 51 | Windows Update for Business, WSUS, SCCM, or the interactive WU dialog in Settings. 52 | 53 | The PowerShell 7.2 MSI package includes following command-line options: 54 | 55 | - `USE_MU` - This property has two possible values: 56 | - `1` (default) - Opts into updating through Microsoft Update or WSUS 57 | - `0` - don't opt into updating through Microsoft Update or WSUS 58 | - `ENABLE_MU` 59 | - `1` (default) - Opts into using Microsoft Update the Automatic Updates or Windows Update 60 | - `0` - don't opt into using Microsoft Update the Automatic Updates or Windows Update 61 | 62 | ## Experimental Features 63 | 64 | The following experimental features are now mainstream features in this release: 65 | 66 | - `Microsoft.PowerShell.Utility.PSImportPSDataFileSkipLimitCheck` - see 67 | [Import-PowerShellDataFile][06] 68 | - `Microsoft.PowerShell.Utility.PSManageBreakpointsInRunspace` 69 | - `PSAnsiRendering` - see [about_ANSI_Terminals][05] 70 | - `PSAnsiProgress` - see [about_ANSI_Terminals][05] 71 | - `PSCultureInvariantReplaceOperator` 72 | - `PSNotApplyErrorActionToStderr` 73 | - `PSUnixFileStat` 74 | 75 | The following experimental feature was added in this release: 76 | 77 | - [PSNativeCommandArgumentPassing][04] - When this experimental feature is enabled PowerShell uses 78 | the **ArgumentList** property of the **StartProcessInfo** object rather than our current mechanism 79 | of reconstructing a string when invoking a native executable. This feature adds a new automatic 80 | variable `$PSNativeCommandArgumentPassing` that allows you to select the behavior at runtime. 81 | 82 | - [PSAnsiRenderingFileInfo][02] - Allow ANSI color customization of file information. 83 | - [PSLoadAssemblyFromNativeCode][03] - Exposes an API to allow assembly loading from native code. 84 | 85 | For more information about the Experimental Features, see [Using Experimental Features][01]. 86 | 87 | ## Improved Tab Completions 88 | 89 | PowerShell 7.2 includes several improvements to Tab Completion. These changes include bugfixes and 90 | improve usability. 91 | 92 | - Fix tab completion for unlocalized about* topics (#15265) (Thanks @MartinGC94) 93 | - Fix splatting being treated as positional parameter in completions (#14623) (Thanks @MartinGC94) 94 | - Add completions for comment-based help keywords (#15337) (Thanks @MartinGC94) 95 | - Add completion for Requires statements (#14596) (Thanks @MartinGC94) 96 | - Added tab completion for View parameter of Format-* cmdlets (#14513) (Thanks @iSazonov) 97 | 98 | ## PSReadLine 2.1 Predictive IntelliSense 99 | 100 | PSReadLine 2.1 introduced `CommandPrediction` APIs that establish a framework for providing 101 | predictions for command-line completion. The API enables users to discover, edit, and execute full 102 | commands based on matching predictions from the user's history. 103 | 104 | Predictive IntelliSense is disabled by default. To enable predictions, run the following command: 105 | 106 | ```powershell 107 | Set-PSReadLineOption -PredictionSource History 108 | ``` 109 | 110 | ## Separating DSC from PowerShell 7 to enable future improvements 111 | 112 | The PSDesiredStateConfiguration module was removed from the PowerShell 7.2 package and is now 113 | published to the PowerShell Gallery. This allows the PSDesiredStateConfiguration module to be 114 | developed independently of PowerShell and users can mix and match versions of PowerShell and 115 | PSDesiredStateConfiguration for their environment. To install PSDesiredStateConfiguration 2.0.5 from 116 | the PowerShell Gallery: 117 | 118 | ```powershell 119 | Install-Module -Name PSDesiredStateConfiguration -Repository PSGallery -MaximumVersion 2.99 120 | ``` 121 | 122 | > [!IMPORTANT] 123 | > Be sure to include the parameter MaximumVersion or you could install version 3 (or higher) of 124 | > PSDesireStateConfiguration that contains significant differences. 125 | 126 | ## Engine updates 127 | 128 | - Add `LoadAssemblyFromNativeMemory` function to load assemblies in memory from a native PowerShell 129 | host by awakecoding · Pull Request #14652 130 | 131 | ## Breaking Changes and Improvements 132 | 133 | - The PSDesiredStateConfiguration was removed from the PowerShell 7.2 package 134 | - Make PowerShell Linux deb and RPM packages universal (#15109) 135 | - Experimental feature `PSNativeCommandArgumentPassing`: Use ArgumentList for native executable 136 | invocation (#14692) 137 | - Ensure `-PipelineVariable` is set for all output from script cmdlets (#12766) 138 | - Emit warning if `ConvertTo-Json` exceeds -Depth value (#13692) 139 | - Remove alias D of -Directory switch CL-General #15171 140 | - Improve detection of mutable value types (#12495) 141 | - Restrict `New-Object` in **NoLanguage** mode under lock down (#14140) 142 | - Enforce AppLocker Deny configuration before Execution Policy Bypass configuration (#15035) 143 | - Change `FileSystemInfo.Target` from a **CodeProperty** to an **AliasProperty** that points to 144 | `FileSystemInfo.LinkTarget` (#16165) 145 | 146 | 147 | 148 | [01]: ../learn/experimental-features.md 149 | [02]: ../learn/experimental-features.md#psansirenderingfileinfo 150 | [03]: ../learn/experimental-features.md#psloadassemblyfromnativecode 151 | [04]: ../learn/experimental-features.md#psnativecommandargumentpassing 152 | [05]: /powershell/module/microsoft.powershell.core/about/about_ansi_terminals 153 | [06]: /powershell/module/microsoft.powershell.utility/import-powershelldatafile 154 | [07]: /powershell/scripting/install/installing-powershell-core-on-linux 155 | [08]: /powershell/scripting/install/installing-powershell-core-on-macos 156 | [09]: /powershell/scripting/install/installing-powershell-core-on-windows 157 | [10]: /powershell/scripting/powershell-support-lifecycle 158 | [11]: https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG/7.2.md 159 | -------------------------------------------------------------------------------- /Microsoft.PowerShell.WhatsNew/relnotes/What-s-New-in-PowerShell-73.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: What's New in PowerShell 7.3 3 | description: New features and changes released in PowerShell 7.3 4 | ms.date: 02/27/2023 5 | --- 6 | 7 | # What's New in PowerShell 7.3 8 | 9 | PowerShell 7.3 is the next stable release, built on .NET 7.0. 10 | 11 | PowerShell 7.3 includes the following features, updates, and breaking changes. 12 | 13 | ## Breaking Changes and Improvements 14 | 15 | - In this release, Windows APIs were updated or removed for compliance, which means that PowerShell 16 | 7.3 doesn't run on Windows 7. While Windows 7 is no longer supported, previous builds could run on 17 | Windows 7. 18 | - PowerShell Direct for Hyper-V is only supported on Windows 10, version 1809 and higher. 19 | - `Test-Connection` is broken due to an intentional [breaking change][09] in .NET 7. It's tracked by 20 | [#17018][10] 21 | - Add `clean` block to script block as a peer to `begin`, `process`, and `end` to allow easy 22 | resource cleanup ([#15177][15177]) 23 | - Change default for `$PSStyle.OutputRendering` to **Host** 24 | - Make `Out-String` and `Out-File` keep string input unchanged ([#17455][17455]) 25 | - Move the type data definition of System.Security.AccessControl.ObjectSecurity to the 26 | Microsoft.PowerShell.Security module ([#16355][16355]) (Thanks @iSazonov!) 27 | - Before this change, a user doesn't need to explicitly import the 28 | **Microsoft.PowerShell.Security** module to use the code properties defined for an instance of 29 | **System.Security.AccessControl.ObjectSecurity**. 30 | - After this change, a user needs to explicitly import **Microsoft.PowerShell.Security** module in 31 | order to use those code properties and code methods. 32 | 33 | ## Tab completion improvements 34 | 35 | - PowerShell 7.3 includes PSReadline 2.2.6, which enables Predictive IntelliSense by default. For 36 | more information, see [about_PSReadLine][12]. 37 | - Fix tab completion within the script block specified for the `ValidateScriptAttribute`. 38 | ([#14550][14550]) (Thanks @MartinGC94!) 39 | - Added tab completion for loop labels after `break`/`continue` ([#16438][16438]) (Thanks 40 | @MartinGC94!) 41 | - Improve Hashtable completion in multiple scenarios ([#16498][16498]) (Thanks @MartinGC94!) 42 | - Parameter splatting 43 | - **Arguments** parameter for `Invoke-CimMethod` 44 | - **FilterHashtable** parameter for `Get-WinEvent` 45 | - **Property** parameter for the CIM cmdlets 46 | - Removes duplicates from member completion scenarios 47 | - Support forward slashes in network share (UNC path) completion ([#17111][17111]) (Thanks @sba923!) 48 | - Improve member autocompletion ([#16504][16504]) (Thanks @MartinGC94!) 49 | - Prioritize ValidateSet completions over Enums for parameters ([#15257][15257]) (Thanks 50 | @MartinGC94!) 51 | - Add type inference support for generic methods with type parameters ([#16951][16951]) (Thanks 52 | @MartinGC94!) 53 | - Improve type inference and completions ([#16963][16963]) (Thanks @MartinGC94!) 54 | - Allows methods to be shown in completion results for `ForEach-Object -MemberName` 55 | - Prevents completion on expressions that return void like `([void](""))` 56 | - Allows non-default Class constructors to show up when class completion is based on the AST 57 | - Improve type inference for `$_` ([#17716][17716]) (Thanks @MartinGC94!) 58 | - Fix type inference for **ICollection** ([#17752][17752]) (Thanks @MartinGC94!) 59 | - Prevent braces from being removed when completing variables ([#17751][17751]) (Thanks 60 | @MartinGC94!) 61 | - Add completion for index expressions for dictionaries ([#17619][17619]) (Thanks @MartinGC94!) 62 | - Fix type completion for attribute tokens ([#17484][17484]) (Thanks @MartinGC94!) 63 | - Improve dynamic parameter tab completion ([#17661][17661]) (Thanks @MartinGC94!) 64 | - Avoid binding positional parameters when completing parameter in front of value ([#17693][17693]) 65 | (Thanks @MartinGC94!) 66 | 67 | ## Improved error handling 68 | 69 | - Set `$?` correctly for command expression with redirections ([#16046][16046]) 70 | - Fix a casting error when using `$PSNativeCommandUseErrorActionPreference` ([#15993][15993]) 71 | - Make the native command error handling optionally honor `ErrorActionPreference` ([#15897][15897]) 72 | - Specify the executable path as `TargetObject` for non-zero exit code ErrorRecord 73 | ([#16108][16108]) (Thanks @rkeithhill!) 74 | 75 | ## Session and remoting improvements 76 | 77 | - Add `-Options` to the PSRP over SSH commands to allow passing OpenSSH options directly 78 | ([#12802][12802]) (Thanks @BrannenGH!) 79 | - Add `-ConfigurationFile` parameter to `pwsh` to allow starting a new process with the session 80 | configuration defined in a `.pssc` file ([#17447][17447]) 81 | - Add support for using `New-PSSessionConfigurationFile` on non-Windows platforms ([#17447][17447]) 82 | 83 | ## Updated cmdlets 84 | 85 | - Add `-HttpVersion` parameter to web cmdlets ([#15853][15853]) (Thanks @hayhay27!) 86 | - Add support to web cmdlets for open-ended input tags ([#16193][16193]) (Thanks @farmerau!) 87 | - Fix `ConvertTo-Json -Depth` to allow 100 at maximum ([#16197][16197]) (Thanks @KevRitchie!) 88 | @rkeithhill!) 89 | - Improve variable handling when calling `Invoke-Command` with the `$using:` expression 90 | ([#16113][16113]) (Thanks @dwtaber!) 91 | - Add `-StrictMode` to `Invoke-Command` to allow specifying strict mode when invoking command 92 | locally ([#16545][16545]) (Thanks @Thomas-Yu!) 93 | - Add `clean` block to script block as a peer to `begin`, `process`, and `end` to allow easy 94 | resource cleanup ([#15177][15177]) 95 | - Add `-Amended` switch to `Get-CimClass` cmdlet ([#17477][17477]) (Thanks @iSazonov) 96 | - Changed `ConvertFrom-Json -AsHashtable` to use ordered hashtable ([#17405][17405]) 97 | - Removed ANSI escape sequences in strings before sending to `Out-GridView` ([#17664][17664]) 98 | - Added the **Milliseconds** parameter to `New-TimeSpan` ([#17621][17621]) (Thanks @NoMoreFood!) 99 | - Show optional parameters when displaying method definitions and overloads ([#13799][13799]) 100 | (Thanks @eugenesmlv!) 101 | - Allow commands to still be executed even if the current working directory no longer exists 102 | ([#17579][17579]) 103 | - Add support for HTTPS with `Set-AuthenticodeSignature -TimeStampServer` ([#16134][16134]) (Thanks 104 | @Ryan-Hutchison-USAF!) 105 | - Render decimal numbers in a table using current culture ([#17650][17650]) 106 | - Add type accelerator ordered for **OrderedDictionary** ([#17804][17804]) (Thanks @fflaten!) 107 | - Add `find.exe` to legacy argument binding behavior for Windows ([#17715][17715]) 108 | - Add `-noprofileloadtime` switch to pwsh ([#17535][17535]) (Thanks @rkeithhill!) 109 | 110 | For a complete list of changes, see the [Change Log][11] in the GitHub repository. 111 | 112 | ## Experimental Features 113 | 114 | In PowerShell 7.3, following experimental features became mainstream: 115 | 116 | - `PSAnsiRenderingFileInfo` - This feature adds the `$PSStyle.FileInfo` member and enables 117 | coloring of specific file types. 118 | - `PSCleanBlock` - Adds `clean` block to script block as a peer to `begin`, `process`, and `end` 119 | to allow easy resource cleanup. 120 | - `PSAMSIMethodInvocationLogging` - Extends the data sent to AMSI for inspection to include all 121 | invocations of .NET method members. 122 | - [PSNativeCommandArgumentPassing][08] - PowerShell now uses the **ArgumentList** property of the 123 | **StartProcessInfo** object rather than the old mechanism of reconstructing a string when invoking 124 | a native executable. 125 | 126 | PowerShell 7.3.1 adds `sqlcmd.exe` to the list of native commands in Windows that use the `Legacy` 127 | style of argument passing. 128 | - `PSExec` - Adds the new `Switch-Process` cmdlet (alias `exec`) to provide `exec` compatibility for 129 | non-Windows systems. 130 | 131 | PowerShell 7.3.1 changed the `exec` alias to a function that wraps `Switch-Process`. The function 132 | allows you to pass parameters to the native command that might have erroneously bound to the 133 | **WithCommand** parameter. 134 | 135 | PowerShell 7.3 introduces the following experimental features: 136 | 137 | - [PSNativeCommandErrorActionPreference][06] - Adds the 138 | `$PSNativeCommandUseErrorActionPreference` variable to enable errors produced by native commands 139 | to be PowerShell errors. 140 | 141 | PowerShell 7.3 removed the following experimental features: 142 | 143 | - `PSNativePSPathResolution` experimental feature is no longer supported. 144 | - `PSStrictModeAssignment` experimental feature is no longer supported. 145 | 146 | For more information about the Experimental Features, see [Using Experimental Features][01]. 147 | 148 | 149 | 150 | [01]: ../learn/experimental-features.md 151 | [06]: ../learn/experimental-features.md#psnativecommanderroractionpreference 152 | [08]: ../learn/experimental-features.md#psnativecommandargumentpassing 153 | [09]: https://github.com/dotnet/runtime/issues/66746 154 | [10]: https://github.com/PowerShell/PowerShell/issues/17018 155 | [11]: https://github.com/PowerShell/PowerShell/releases/tag/v7.3.0 156 | [12]: /powershell/module/psreadline/about/about_psreadline#psreadline-release-history 157 | [12802]: https://github.com/PowerShell/PowerShell/pull/12802 158 | [13799]: https://github.com/PowerShell/PowerShell/pull/13799 159 | [14550]: https://github.com/PowerShell/PowerShell/pull/14550 160 | [15177]: https://github.com/PowerShell/PowerShell/pull/15177 161 | [15257]: https://github.com/PowerShell/PowerShell/pull/15257 162 | [15853]: https://github.com/PowerShell/PowerShell/pull/15853 163 | [15897]: https://github.com/PowerShell/PowerShell/pull/15897 164 | [15993]: https://github.com/PowerShell/PowerShell/pull/15993 165 | [16046]: https://github.com/PowerShell/PowerShell/pull/16046 166 | [16108]: https://github.com/PowerShell/PowerShell/pull/16108 167 | [16113]: https://github.com/PowerShell/PowerShell/pull/16113 168 | [16134]: https://github.com/PowerShell/PowerShell/pull/16134 169 | [16193]: https://github.com/PowerShell/PowerShell/pull/16193 170 | [16197]: https://github.com/PowerShell/PowerShell/pull/16197 171 | [16355]: https://github.com/PowerShell/PowerShell/pull/16355 172 | [16438]: https://github.com/PowerShell/PowerShell/pull/16438 173 | [16498]: https://github.com/PowerShell/PowerShell/pull/16498 174 | [16504]: https://github.com/PowerShell/PowerShell/pull/16504 175 | [16545]: https://github.com/PowerShell/PowerShell/pull/16545 176 | [16951]: https://github.com/PowerShell/PowerShell/pull/16951 177 | [16963]: https://github.com/PowerShell/PowerShell/pull/16963 178 | [17111]: https://github.com/PowerShell/PowerShell/pull/17111 179 | [17405]: https://github.com/PowerShell/PowerShell/pull/17405 180 | [17447]: https://github.com/PowerShell/PowerShell/pull/17447 181 | [17455]: https://github.com/PowerShell/PowerShell/pull/17455 182 | [17477]: https://github.com/PowerShell/PowerShell/pull/17477 183 | [17484]: https://github.com/PowerShell/PowerShell/pull/17484 184 | [17535]: https://github.com/PowerShell/PowerShell/pull/17535 185 | [17579]: https://github.com/PowerShell/PowerShell/pull/17579 186 | [17619]: https://github.com/PowerShell/PowerShell/pull/17619 187 | [17621]: https://github.com/PowerShell/PowerShell/pull/17621 188 | [17650]: https://github.com/PowerShell/PowerShell/pull/17650 189 | [17661]: https://github.com/PowerShell/PowerShell/pull/17661 190 | [17664]: https://github.com/PowerShell/PowerShell/pull/17664 191 | [17693]: https://github.com/PowerShell/PowerShell/pull/17693 192 | [17715]: https://github.com/PowerShell/PowerShell/pull/17715 193 | [17716]: https://github.com/PowerShell/PowerShell/pull/17716 194 | [17751]: https://github.com/PowerShell/PowerShell/pull/17751 195 | [17752]: https://github.com/PowerShell/PowerShell/pull/17752 196 | [17804]: https://github.com/PowerShell/PowerShell/pull/17804 197 | -------------------------------------------------------------------------------- /Microsoft.PowerShell.WhatsNew/relnotes/What-s-New-in-PowerShell-74.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: What's New in PowerShell 7.4 3 | description: New features and changes released in PowerShell 7.4 4 | ms.date: 06/19/2024 5 | --- 6 | 7 | # What's New in PowerShell 7.4 8 | 9 | PowerShell 7.4 includes the following features, updates, and breaking changes. PowerShell 7.4 is 10 | built on .NET 8.0.0. 11 | 12 | For a complete list of changes, see the [CHANGELOG][chg] in the GitHub repository. 13 | 14 | ## Breaking changes 15 | 16 | - Nano server docker images aren't available for this release 17 | - Added the **ProgressAction** parameter to the Common Parameters 18 | - Update some PowerShell APIs to throw **ArgumentException** instead of **ArgumentNullException** 19 | when the argument is an empty string ([#19215][19215]) (Thanks @xtqqczze!) 20 | - Remove code related to `#requires -pssnapin` ([#19320][19320]) 21 | - `Test-Json` now uses JsonSchema.Net instead of Newtonsoft.Json.Schema. With this change, 22 | `Test-Json` no longer supports the older Draft 4 schemas. ([#18141][18141]) (Thanks @gregsdennis!) 23 | For more information about JSON schemas, see [JSON Schema][14] documentation. 24 | - Output from `Test-Connection` now includes more detailed information about TCP connection tests 25 | - .NET introduced changes that affected `Test-Connection`. The cmdlet now returns an error about 26 | the need to use `sudo` on Linux platforms when using a custom buffer size ([#20369][20369]) 27 | - Experimental feature [PSNativeCommandPreserveBytePipe][10] is now mainstream. PowerShell now 28 | preserves the byte-stream data when redirecting the **stdout** stream of a native command to a 29 | file or when piping byte-stream data to the stdin stream of a native command. 30 | - Change how relative paths in `Resolve-Path` are handled when using the **RelativeBasePath** 31 | parameter ([#19755][19755]) (Thanks @MartinGC94!) 32 | - Remove unused PSv2 code - removes TabExpansion function ([#18337][18337]) 33 | 34 | ## Installer updates 35 | 36 | The Windows MSI package now provides an option to disable PowerShell telemetry during installation. 37 | For more information, see [Install the msi package from the command line][01]. 38 | 39 | ## Updated versions of PSResourceGet and PSReadLine 40 | 41 | PowerShell 7.4 includes **Microsoft.PowerShell.PSResourceGet** v1.0.1. This module is installed 42 | side-by-side with **PowerShellGet** v2.2.5 and **PackageManagement** v1.4.8.1. For more information, 43 | see the documentation for [Microsoft.PowerShell.PSResourceGet][12]. 44 | 45 | PowerShell 7.4 now includes **PSReadLine** v2.3.4. For more information, see the documentation for 46 | [PSReadLine][13]. 47 | 48 | ## Tab completion improvements 49 | 50 | Many thanks to **@MartinGC94** and others for all their work to improve tab completion. 51 | 52 | - Fix issue when completing the first command in a script with an empty array expression 53 | ([#18355][18355]) 54 | - Fix positional argument completion ([#17796][17796]) 55 | - Prioritize the default parameter set when completing positional arguments ([#18755][18755]) 56 | - Improve pseudo binding for dynamic parameters ([#18030][18030]) 57 | - Improve type inference of hashtable keys ([#17907][17907]) 58 | - Fix type inference error for empty return statements ([#18351][18351]) 59 | - Improve type inference for Get-Random ([#18972][18972]) 60 | - Fix type inference for all scope variables ([#18758][18758]) 61 | - Improve enumeration of inferred types in pipeline ([#17799][17799]) 62 | - Add completion for values in comparisons when comparing Enums ([#17654][17654]) 63 | - Add property assignment completion for enums ([#19178][19178]) 64 | - Fix completion for PSCustomObject variable properties ([#18682][18682]) 65 | - Fix member completion in attribute argument ([#17902][17902]) 66 | - Exclude redundant parameter aliases from completion results ([#19382][19382]) 67 | - Fix class member completion for classes with base types ([#19179][19179]) 68 | - Add completion for Using keywords ([#16514][18758]) 69 | - Fix TabExpansion2 variable leak when completing variables ([#18763][18763]) 70 | - Enable completion of variables across ScriptBlock scopes ([#19819][19819]) 71 | - Fix completion of the foreach statement variable ([#19814][19814]) 72 | - Fix variable type inference precedence ([#18691][18691]) 73 | - Fix member completion for PowerShell Enum class ([#19740][19740]) 74 | - Fix parsing for array literals in index expressions in method calls ([#19224][19224]) 75 | - Improve path completion ([#19489][19489]) 76 | - Fix an indexing out of bound error in CompleteInput for empty script input ([#19501][19501]) 77 | - Improve variable completion performance ([#19595][19595]) 78 | - Improve Hashtable key completion for type constrained variable assignments, nested Hashtables and 79 | more ([#17660][17660]) 80 | - Infer external application output as strings ([#19193][19193]) 81 | - Update parameter completion for enums to exclude values not allowed by `ValidateRange` attributes 82 | ([#17750][17750]) (Thanks @fflaten!). 83 | - Fix dynamic parameter completion ([#19510][19510]) 84 | - Add completion for variables assigned by the Data statement ([#19831][19831]) 85 | - Fix expanding tilde (`~`) on Windows systems to `$home` to prevent breaking use cases with native 86 | commands ([#21529][21529]) 87 | 88 | ## Web cmdlet improvements 89 | 90 | Many thanks to **@CarloToso** and others for all the work on improving web cmdlets. 91 | 92 | - Fix decompression in web cmdlets to include Brotli ([#17955][17955]) (Thanks @iSazonov!) 93 | - Webcmdlets add 308 to redirect codes and small cleanup ([#18536][18536]) 94 | - Complete the progress bar rendering in Invoke-WebRequest when downloading is complete or cancelled 95 | ([#18130][18130]) 96 | - Web cmdlets get **Retry-After** interval from response headers if the status code is 429 97 | ([#18717][18717]) 98 | - Web cmdlets set default charset encoding to UTF8 ([#18219][18219]) 99 | - Preserve WebSession.MaximumRedirection from changes ([#19190][19190]) 100 | - WebCmdlets parse XML declaration to get encoding value, if present. ([#18748][18748]) 101 | - Fix using xml -Body in webcmdlets without an encoding ([#19281][19281]) 102 | - Adjust PUT method behavior to POST one for default content type in WebCmdlets ([#19152][19152]) 103 | - Take into account ContentType from Headers in WebCmdlets ([#19227][19227]) 104 | - Allow to preserve the original HTTP method by adding **-PreserveHttpMethodOnRedirect** to Web 105 | cmdlets ([#18894][18894]) 106 | - Webcmdlets display an error on https to http redirect ([#18595][18595]) 107 | - Add **AllowInsecureRedirect** switch to Web cmdlets ([#18546][18546]) 108 | - Improve verbose message in web cmdlets when content length is unknown ([#19252][19252]) 109 | - Build the relative URI for links from the response in `Invoke-WebRequest` ([#19092][19092]) 110 | - Fix redirection for `-CustomMethod POST` in WebCmdlets ([#19111][19111]) 111 | - Dispose previous response in Webcmdlets ([#19117][19117]) 112 | - Improve `Invoke-WebRequest` xml and json errors format ([#18837][18837]) 113 | - Add ValidateNotNullOrEmpty to **OutFile** and **InFile** parameters of WebCmdlets 114 | ([#19044][19044]) 115 | - HttpKnownHeaderNames update headers list ([#18947][18947]) 116 | - `Invoke-RestMethod -FollowRelLink` fix links containing commas ([#18829][18829]) 117 | - Fix bug with managing redirection and KeepAuthorization in Web cmdlets ([#18902][18902]) 118 | - Add **StatusCode** to **HttpResponseException** ([#18842][18842]) 119 | - Support HTTP persistent connections in Web Cmdlets ([#19249][19249]) (Thanks @stevenebutler!) 120 | - Small cleanup `Invoke-RestMethod` ([#19490][19490]) 121 | - Improve the verbose message of WebCmdlets to show correct HTTP version ([#19616][19616]) 122 | - Add **FileNameStar** to **MultipartFileContent** in WebCmdlets ([#19467][19467]) 123 | - Fix HTTP status from 409 to 429 for WebCmdlets to get retry interval from Retry-After header. 124 | ([#19622][19622]) (Thanks @mkht!) 125 | - Change `-TimeoutSec` to `-ConnectionTimeoutSeconds` and add `-OperationTimeoutSeconds` to web 126 | cmdlets ([#19558][19558]) (Thanks @stevenebutler!) Other cmdlets 127 | - Support Ctrl+c when connection hangs while reading data in WebCmdlets ([#19330][19330]) (Thanks 128 | @stevenebutler!) 129 | - Support Unix domain socket in WebCmdlets ([#19343][19343]) 130 | 131 | ## Other cmdlet improvements 132 | 133 | - `Test-Connection` now returns error about the need to use `sudo` on Linux platforms when using a 134 | custom buffer size ([#20369][20369]) 135 | - Add output types to Format commands ([#18746][18746]) (Thanks @MartinGC94!) 136 | - Add output type attributes for `Get-WinEvent` ([#17948][17948]) (Thanks @MartinGC94!) 137 | - Add **Path** and **LiteralPath** parameters to `Test-Json` cmdlet ([#19042][19042]) (Thanks 138 | @ArmaanMcleod!) 139 | - Add **NoHeader** parameter to `ConvertTo-Csv` and `Export-Csv` cmdlets ([#19108][19108]) (Thanks 140 | @ArmaanMcleod!) 141 | - Add **Confirm** and **WhatIf** parameters to `Stop-Transcript`([#18731][18731]) (Thanks 142 | @JohnLBevan!) 143 | - Add **FuzzyMinimumDistance** parameter to `Get-Command` ([#18261][18261]) 144 | - Make **Encoding** parameter able to take `ANSI` encoding in PowerShell ([#19298][19298]) (Thanks 145 | @CarloToso!) 146 | - Add progress to `Copy-Item` ([#18735][18735]) 147 | - `Update-Help` now reports an error when using implicit culture on non-US systems. 148 | ([#17780][17780]) (Thanks @dkaszews!) 149 | - Don't require activity when creating a completed progress record ([#18474][18474]) (Thanks 150 | @MartinGC94!) 151 | - Disallow negative values for `Get-Content` cmdlet parameters `-Head` and `-Tail` 152 | ([#19715][19715]) (Thanks @CarloToso!) 153 | - Make `Update-Help` throw proper error when current culture isn't associated with a language 154 | ([#19765][19765]) (Thanks @josea!) 155 | - Allow combining of `-Skip` and `-SkipLast` parameters in `Select-Object` cmdlet. 156 | ([#18849][18849]) (Thanks @ArmaanMcleod!) 157 | - Add `Get-SecureRandom` cmdlet ([#19587][19587]) 158 | - `Set-Clipboard -AsOSC52` for remote usage ([#18222][18222]) (Thanks @dkaszews!) 159 | - Speed up `Resolve-Path` relative path resolution ([#19171][19171]) (Thanks @MartinGC94!) 160 | - Added the switch parameter `-CaseInsensitive` to `Select-Object` and `Get-Unique` cmdlets 161 | ([#19683][19683]) (Thanks @ArmaanMcleod!) 162 | - `Restart-Computer` and `Stop-Computer` should fail with error when not running via sudo on Unix 163 | ([#19824][19824]) 164 | 165 | ## Engine improvements 166 | 167 | Updates to `$PSStyle` 168 | 169 | - Adds **Dim** and **DimOff** properties ([#18653][18653]) 170 | - Added static methods to the **PSStyle** class that map foreground and background **ConsoleColor** 171 | values to ANSI escape sequences ([#17938][17938]) 172 | - Table headers for calculated fields are formatted in italics by default 173 | - Add support of respecting `$PSStyle.OutputRendering` on the remote host ([#19601][19601]) 174 | - Updated telemetry data to include use of `CrescendoBuilt` modules ([#20371][20371]) 175 | 176 | Other Engine updates 177 | 178 | - Make PowerShell class not affiliate with Runspace when declaring the `NoRunspaceAffinity` 179 | attribute ([#18138][18138]) 180 | - Add the `ValidateNotNullOrWhiteSpace` attribute ([#17191][17191]) (Thanks @wmentha!) 181 | - Add `sqlcmd` to the list for legacy argument passing ([#18559][18559]) 182 | - Add the function `cd~` ([#18308][18308]) (Thanks @GigaScratch!) 183 | - Fix array type parsing in generic types ([#19205][19205]) (Thanks @MartinGC94!) 184 | - Fix wildcard globbing in root of device paths ([#19442][19442]) (Thanks @MartinGC94!) 185 | - Add a public API for getting locations of PSModulePath elements ([#19422][19422]) 186 | - Fix incorrect string to type conversion ([#19560][19560]) (Thanks @MartinGC94!) 187 | - Fix slow execution when many breakpoints are used ([#14953][14953]) (Thanks @nohwnd!) 188 | - Remove code related to `#requires -pssnapin` ([#19320][19320]) 189 | 190 | ## Experimental Features 191 | 192 | PowerShell 7.4 introduces the following experimental features: 193 | 194 | - [PSFeedbackProvider][06] - Replaces the hard-coded suggestion framework with an extensible 195 | feedback provider. 196 | - This feature also adds the **FeedbackName**, **FeedbackText**, and **FeedbackAction** properties 197 | to `$PSStyle.Formatting` that allow you to change the formatting of feedback messages. 198 | - [PSModuleAutoLoadSkipOfflineFiles][07] - Module discovery now skips over files that are marked by 199 | cloud providers as not fully on disk. 200 | - [PSCommandWithArgs][05] - Add support for passing arguments to commands as a single string 201 | 202 | The following experimental features became mainstream: 203 | 204 | - [PSConstrainedAuditLogging][02] 205 | - [PSCustomTableHeaderLabelDecoration][08] 206 | - [PSNativeCommandErrorActionPreference][10] 207 | - [PSNativeCommandPreserveBytePipe][11] 208 | - [PSWindowsNativeCommandArgPassing][09] 209 | 210 | PowerShell 7.4 changed the following experimental features: 211 | 212 | - [PSCommandNotFoundSuggestion][04] - This feature now uses an extensible feedback provider rather 213 | than hard-coded suggestions ([#18726][18726]) 214 | 215 | For more information about the Experimental Features, see [Using Experimental Features][03]. 216 | 217 | 218 | 219 | [01]: ../install/installing-powershell-on-windows.md 220 | [02]: ../security/application-control.md#wdac-policy-auditing 221 | [03]: ../learn/experimental-features.md 222 | [04]: ../learn/experimental-features.md#pscommandnotfoundsuggestion 223 | [05]: ../learn/experimental-features.md#pscommandwithargs 224 | [06]: ../learn/experimental-features.md#psfeedbackprovider 225 | [07]: ../learn/experimental-features.md#psmoduleautoloadskipofflinefiles 226 | [08]: /powershell/module/microsoft.powershell.core/about/about_ansi_terminals 227 | [09]: /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommandargumentpassing 228 | [10]: /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommanduseerroractionpreference 229 | [11]: /powershell/module/microsoft.powershell.core/about/about_redirection?view=powershell-7.4&preserve-view=true#redirecting-output-from-native-commands 230 | [12]: /powershell/module/microsoft.powershell.psresourceget 231 | [13]: /powershell/module/psreadline 232 | [14]: https://json-schema.org/understanding-json-schema/reference/schema 233 | 234 | [chg]: https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG/7.4.md 235 | [14953]: https://github.com/PowerShell/PowerShell/pull/14953 236 | [17191]: https://github.com/PowerShell/PowerShell/pull/17191 237 | [17654]: https://github.com/PowerShell/PowerShell/pull/17654 238 | [17660]: https://github.com/PowerShell/PowerShell/pull/17660 239 | [17750]: https://github.com/PowerShell/PowerShell/pull/17750 240 | [17780]: https://github.com/PowerShell/PowerShell/pull/17780 241 | [17796]: https://github.com/PowerShell/PowerShell/pull/17796 242 | [17799]: https://github.com/PowerShell/PowerShell/pull/17799 243 | [17902]: https://github.com/PowerShell/PowerShell/pull/17902 244 | [17907]: https://github.com/PowerShell/PowerShell/pull/17907 245 | [17938]: https://github.com/PowerShell/PowerShell/pull/17938 246 | [17948]: https://github.com/PowerShell/PowerShell/pull/17948 247 | [17955]: https://github.com/PowerShell/PowerShell/pull/17955 248 | [18030]: https://github.com/PowerShell/PowerShell/pull/18030 249 | [18130]: https://github.com/PowerShell/PowerShell/pull/18130 250 | [18138]: https://github.com/PowerShell/PowerShell/pull/18138 251 | [18141]: https://github.com/PowerShell/PowerShell/pull/18141 252 | [18219]: https://github.com/PowerShell/PowerShell/pull/18219 253 | [18222]: https://github.com/PowerShell/PowerShell/pull/18222 254 | [18261]: https://github.com/PowerShell/PowerShell/pull/18261 255 | [18308]: https://github.com/PowerShell/PowerShell/pull/18308 256 | [18337]: https://github.com/PowerShell/PowerShell/pull/18337 257 | [18351]: https://github.com/PowerShell/PowerShell/pull/18351 258 | [18355]: https://github.com/PowerShell/PowerShell/pull/18355 259 | [18474]: https://github.com/PowerShell/PowerShell/pull/18474 260 | [18536]: https://github.com/PowerShell/PowerShell/pull/18536 261 | [18546]: https://github.com/PowerShell/PowerShell/pull/18546 262 | [18559]: https://github.com/PowerShell/PowerShell/pull/18559 263 | [18595]: https://github.com/PowerShell/PowerShell/pull/18595 264 | [18653]: https://github.com/PowerShell/PowerShell/pull/18653 265 | [18682]: https://github.com/PowerShell/PowerShell/pull/18682 266 | [18691]: https://github.com/PowerShell/PowerShell/pull/18691 267 | [18695]: https://github.com/PowerShell/PowerShell/pull/18695 268 | [18717]: https://github.com/PowerShell/PowerShell/pull/18717 269 | [18726]: https://github.com/PowerShell/PowerShell/pull/18726 270 | [18731]: https://github.com/PowerShell/PowerShell/pull/18731 271 | [18735]: https://github.com/PowerShell/PowerShell/pull/18735 272 | [18746]: https://github.com/PowerShell/PowerShell/pull/18746 273 | [18748]: https://github.com/PowerShell/PowerShell/pull/18748 274 | [18755]: https://github.com/PowerShell/PowerShell/pull/18755 275 | [18758]: https://github.com/PowerShell/PowerShell/pull/18758 276 | [18763]: https://github.com/PowerShell/PowerShell/pull/18763 277 | [18829]: https://github.com/PowerShell/PowerShell/pull/18829 278 | [18837]: https://github.com/PowerShell/PowerShell/pull/18837 279 | [18842]: https://github.com/PowerShell/PowerShell/pull/18842 280 | [18849]: https://github.com/PowerShell/PowerShell/pull/18849 281 | [18894]: https://github.com/PowerShell/PowerShell/pull/18894 282 | [18902]: https://github.com/PowerShell/PowerShell/pull/18902 283 | [18947]: https://github.com/PowerShell/PowerShell/pull/18947 284 | [18972]: https://github.com/PowerShell/PowerShell/pull/18972 285 | [19042]: https://github.com/PowerShell/PowerShell/pull/19042 286 | [19044]: https://github.com/PowerShell/PowerShell/pull/19044 287 | [19092]: https://github.com/PowerShell/PowerShell/pull/19092 288 | [19108]: https://github.com/PowerShell/PowerShell/pull/19108 289 | [19111]: https://github.com/PowerShell/PowerShell/pull/19111 290 | [19117]: https://github.com/PowerShell/PowerShell/pull/19117 291 | [19152]: https://github.com/PowerShell/PowerShell/pull/19152 292 | [19171]: https://github.com/PowerShell/PowerShell/pull/19171 293 | [19178]: https://github.com/PowerShell/PowerShell/pull/19178 294 | [19179]: https://github.com/PowerShell/PowerShell/pull/19179 295 | [19190]: https://github.com/PowerShell/PowerShell/pull/19190 296 | [19193]: https://github.com/PowerShell/PowerShell/pull/19193 297 | [19205]: https://github.com/PowerShell/PowerShell/pull/19205 298 | [19215]: https://github.com/PowerShell/PowerShell/pull/19215 299 | [19224]: https://github.com/PowerShell/PowerShell/pull/19224 300 | [19227]: https://github.com/PowerShell/PowerShell/pull/19227 301 | [19249]: https://github.com/PowerShell/PowerShell/pull/19249 302 | [19252]: https://github.com/PowerShell/PowerShell/pull/19252 303 | [19281]: https://github.com/PowerShell/PowerShell/pull/19281 304 | [19298]: https://github.com/PowerShell/PowerShell/pull/19298 305 | [19320]: https://github.com/PowerShell/PowerShell/pull/19320 306 | [19330]: https://github.com/PowerShell/PowerShell/pull/19330 307 | [19343]: https://github.com/PowerShell/PowerShell/pull/19343 308 | [19382]: https://github.com/PowerShell/PowerShell/pull/19382 309 | [19422]: https://github.com/PowerShell/PowerShell/pull/19422 310 | [19442]: https://github.com/PowerShell/PowerShell/pull/19442 311 | [19467]: https://github.com/PowerShell/PowerShell/pull/19467 312 | [19489]: https://github.com/PowerShell/PowerShell/pull/19489 313 | [19490]: https://github.com/PowerShell/PowerShell/pull/19490 314 | [19501]: https://github.com/PowerShell/PowerShell/pull/19501 315 | [19510]: https://github.com/PowerShell/PowerShell/pull/19510 316 | [19558]: https://github.com/PowerShell/PowerShell/pull/19558 317 | [19560]: https://github.com/PowerShell/PowerShell/pull/19560 318 | [19587]: https://github.com/PowerShell/PowerShell/pull/19587 319 | [19595]: https://github.com/PowerShell/PowerShell/pull/19595 320 | [19601]: https://github.com/PowerShell/PowerShell/pull/19601 321 | [19616]: https://github.com/PowerShell/PowerShell/pull/19616 322 | [19622]: https://github.com/PowerShell/PowerShell/pull/19622 323 | [19683]: https://github.com/PowerShell/PowerShell/pull/19683 324 | [19715]: https://github.com/PowerShell/PowerShell/pull/19715 325 | [19740]: https://github.com/PowerShell/PowerShell/pull/19740 326 | [19755]: https://github.com/PowerShell/PowerShell/pull/19755 327 | [19765]: https://github.com/PowerShell/PowerShell/pull/19765 328 | [19814]: https://github.com/PowerShell/PowerShell/pull/19814 329 | [19819]: https://github.com/PowerShell/PowerShell/pull/19819 330 | [19824]: https://github.com/PowerShell/PowerShell/pull/19824 331 | [19831]: https://github.com/PowerShell/PowerShell/pull/19831 332 | [20369]: https://github.com/PowerShell/PowerShell/pull/20369 333 | [20371]: https://github.com/PowerShell/PowerShell/pull/20371 334 | [21529]: https://github.com/PowerShell/PowerShell/pull/21529 335 | -------------------------------------------------------------------------------- /Microsoft.PowerShell.WhatsNew/relnotes/What-s-New-in-PowerShell-75.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: What's New in PowerShell 7.5 3 | description: New features and changes released in PowerShell 7.5 4 | ms.date: 05/16/2024 5 | --- 6 | 7 | # What's New in PowerShell 7.5 8 | 9 | PowerShell 7.5-preview.3 includes the following features, updates, and breaking changes. PowerShell 10 | 7.5 is built on .NET 9.0.0-preview.3. 11 | 12 | For a complete list of changes, see the [CHANGELOG][chg] in the GitHub repository. 13 | 14 | ## Breaking Changes 15 | 16 | - Fix `-OlderThan` and `-NewerThan` parameters for `Test-Path` when using `PathType` and date range 17 | ([#20942][20942]) (Thanks @ArmaanMcleod!) 18 | - Previously `-OlderThan` would be ignored if specified together 19 | - Change `New-FileCatalog -CatalogVersion` default to 2 ([#20428][20428]) (Thanks @ThomasNieto!) 20 | - Block getting help from network locations in restricted remoting sessions ([#20593][20593]) 21 | - The Windows installer now remembers installation options used and uses them to initialize options 22 | for the next installation ([#20420][20420]) (Thanks @reduckted!) 23 | - `ConvertTo-Json` now serializes `BigInteger` as a number ([#21000][21000]) (Thanks @jborean93!) 24 | 25 | ## Updated modules 26 | 27 | PowerShell 7.5-preview.3 includes the following updated modules: 28 | 29 | - **Microsoft.PowerShell.PSResourceGet** v1.0.5 30 | - **PSReadLine** v2.3.4 31 | 32 | ## Tab completion improvements 33 | 34 | Many thanks to **@ArmaanMcleod** and others for all their work to improve tab completion. 35 | 36 | - Fall back to type inference when hashtable key-value cannot be retrieved from safe expression 37 | ([#21184][21184]) (Thanks @MartinGC94!) 38 | - Fix the regression when doing type inference for `$_` ([#21223][21223]) (Thanks @MartinGC94!) 39 | - Expand `~` to `$home` on Windows with tab completion ([#21529][21529]) 40 | - Don't complete when declaring parameter name and class member ([#21182][21182]) (Thanks 41 | @MartinGC94!) 42 | - Prevent fallback to file completion when tab completing type names ([#20084][20084]) (Thanks 43 | @MartinGC94) 44 | - Add argument completer to `-Version` for `Set-StrictMode` ([#20554][20554]) (Thanks 45 | @ArmaanMcleod!) 46 | - Add `-Verb` argument completer for `Get-Verb`/ `Get-Command` and refactor `Get-Verb` 47 | ([#20286][20286]) (Thanks @ArmaanMcleod) 48 | - Add `-Verb` argument completer for `Start-Process` ([#20415][20415]) (Thanks @ArmaanMcleod) 49 | - Add `-Scope` argument completer for `*-Variable`, `*-Alias` & `*-PSDrive` commands 50 | ([#20451][20451]) (Thanks @ArmaanMcleod) 51 | - Add `-Module` completion for `Save-Help`/`Update-Help` commands ([#20678][20678]) (Thanks 52 | @ArmaanMcleod) 53 | 54 | ## Web Cmdlets improvements 55 | 56 | - Fix `Invoke-WebRequest` to report correct size when `-Resume` is specified ([#20207][20207]) 57 | (Thanks @LNKLEO!) 58 | - Fix Web Cmdlets to allow `WinForm` apps to work correctly ([#20606][20606]) 59 | 60 | ## Other cmdlet improvements 61 | 62 | - `Get-Process`: Remove admin requirement for `-IncludeUserName` ([#21302][21302]) (Thanks @jborean93!) 63 | - Fix `Test-Path -IsValid` to check for invalid path and filename characters ([#21358][21358]) 64 | - Add `RecommendedAction` to `ConciseView` of the error reporting ([#20826][20826]) (Thanks @JustinGrote!) 65 | - Added progress bar for `Remove-Item` cmdlet ([#20778][20778]) (Thanks @ArmaanMcleod!) 66 | - Fix `Test-Connection` due to .NET 8 changes ([#20369][20369]) 67 | - Fix `Get-Service` non-terminating error message to include category ([#20276][20276]) 68 | - Add `-Empty` and `-InputObject` parameters to `New-Guid` ([#20014][20014]) (Thanks @CarloToso!) 69 | - Add the alias `r` to the parameter `-Recurse` for the `Get-ChildItem` command ([#20100][20100]) 70 | (Thanks @kilasuit!) 71 | - Add `LP` to `LiteralPath` aliases for functions still missing it ([#20820][20820]) 72 | - Add implicit localization fallback to `Import-LocalizedData` ([#19896][19896]) (Thanks 73 | @chrisdent-de!) 74 | - Add `Aliases` to the properties shown up when formatting the help content of the parameter 75 | returned by `Get-Help` ([#20994][20994]) 76 | - Add `HelpUri` to `Remove-Service` ([#20476][20476]) 77 | - Fix completion crash for the SCCM provider (#20815, #20919, #20915) (Thanks @MartinGC94!) 78 | - Fix regression in `Get-Content` when `-Tail 0` and `-Wait` are used together ([#20734][20734]) 79 | (Thanks @CarloToso!) 80 | - Fix `Start-Process -PassThru` to make sure the `ExitCode` property is accessible for the returned 81 | `Process` object ([#20749][20749]) (Thanks @CodeCyclone!) 82 | - Fix `Group-Object` to use current culture for its output ([#20608][20608]) 83 | - Fix `Group-Object` output using interpolated strings ([#20745][20745]) (Thanks @mawosoft!) 84 | - Fix rendering of `DisplayRoot` for network `PSDrive` ([#20793][20793]) 85 | - Fix `Copy-Item` progress to only show completed when all files are copied ([#20517][20517]) 86 | - Fix UNC path completion regression ([#20419][20419]) (Thanks @MartinGC94!) 87 | - Report error if invalid `-ExecutionPolicy` is passed to `pwsh` ([#20460][20460]) 88 | - Add **WinGetCommandNotFound** and **CompletionPredictor** modules to track usage ([#21040][21040]) 89 | - Add **DateKind** parameter to `ConvertFrom-Json` ([#20925][20925]) (Thanks @jborean93!) 90 | - Add **DirectoryInfo** to the OutputType for New-Item ([#21126][21126]) (Thanks @MartinGC94!) 91 | - Fix 1 serialization of array values ([#21085][21085]) (Thanks @jborean93!) 92 | 93 | ## Engine improvements 94 | 95 | - Add telemetry to check for specific tags when importing a module ([#20371][20371]) 96 | - Add `PSAdapter` and `ConsoleGuiTools` to module load telemetry allowlist ([#20641][20641]) 97 | - Add Winget module to track usage ([#21040][21040]) 98 | - Ensure the filename is not null when logging WDAC ETW events ([#20910][20910]) (Thanks 99 | @jborean93!) 100 | - Fix four regressions introduced by the WDAC logging feature ([#20913][20913]) 101 | - Leave the input, output, and error handles unset when they are not redirected ([#20853][20853]) 102 | - Fix implicit remoting proxy cmdlets to act on common parameters ([#20367][20367]) 103 | - Include the module version in error messages when module is not found ([#20144][20144]) (Thanks 104 | @ArmaanMcleod!) 105 | - Fix `unixmode` to handle `setuid` and `sticky` when file is not an executable ([#20366][20366]) 106 | - Fix using assembly to use Path.Combine when constructing assembly paths ([#21169][21169]) 107 | - Validate the value for using namespace during semantic checks to prevent declaring invalid 108 | namespaces ([#21162][21162]) 109 | 110 | ## Experimental features 111 | 112 | - Add tilde expansion for windows native executables ([#20402][20402]) (Thanks @domsleee!) 113 | For more information, see [PSNativeWindowsTildeExpansion][01] 114 | 115 | 116 | 117 | [chg]: https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG/preview.md 118 | 119 | [01]: ../learn/experimental-features.md#psnativewindowstildeexpansion 120 | 121 | [19896]: https://github.com/PowerShell/PowerShell/pull/19896 122 | [20014]: https://github.com/PowerShell/PowerShell/pull/20014 123 | [20084]: https://github.com/PowerShell/PowerShell/pull/20084 124 | [20100]: https://github.com/PowerShell/PowerShell/pull/20100 125 | [20144]: https://github.com/PowerShell/PowerShell/pull/20144 126 | [20207]: https://github.com/PowerShell/PowerShell/pull/20207 127 | [20276]: https://github.com/PowerShell/PowerShell/pull/20276 128 | [20286]: https://github.com/PowerShell/PowerShell/pull/20286 129 | [20366]: https://github.com/PowerShell/PowerShell/pull/20366 130 | [20367]: https://github.com/PowerShell/PowerShell/pull/20367 131 | [20369]: https://github.com/PowerShell/PowerShell/pull/20369 132 | [20371]: https://github.com/PowerShell/PowerShell/pull/20371 133 | [20402]: https://github.com/PowerShell/PowerShell/pull/20402 134 | [20415]: https://github.com/PowerShell/PowerShell/pull/20415 135 | [20419]: https://github.com/PowerShell/PowerShell/pull/20419 136 | [20420]: https://github.com/PowerShell/PowerShell/pull/20420 137 | [20428]: https://github.com/PowerShell/PowerShell/pull/20428 138 | [20451]: https://github.com/PowerShell/PowerShell/pull/20451 139 | [20460]: https://github.com/PowerShell/PowerShell/pull/20460 140 | [20476]: https://github.com/PowerShell/PowerShell/pull/20476 141 | [20517]: https://github.com/PowerShell/PowerShell/pull/20517 142 | [20554]: https://github.com/PowerShell/PowerShell/pull/20554 143 | [20593]: https://github.com/PowerShell/PowerShell/pull/20593 144 | [20606]: https://github.com/PowerShell/PowerShell/pull/20606 145 | [20608]: https://github.com/PowerShell/PowerShell/pull/20608 146 | [20641]: https://github.com/PowerShell/PowerShell/pull/20641 147 | [20678]: https://github.com/PowerShell/PowerShell/pull/20678 148 | [20734]: https://github.com/PowerShell/PowerShell/pull/20734 149 | [20745]: https://github.com/PowerShell/PowerShell/pull/20745 150 | [20749]: https://github.com/PowerShell/PowerShell/pull/20749 151 | [20778]: https://github.com/PowerShell/PowerShell/pull/20778 152 | [20793]: https://github.com/PowerShell/PowerShell/pull/20793 153 | [20820]: https://github.com/PowerShell/PowerShell/pull/20820 154 | [20826]: https://github.com/PowerShell/PowerShell/pull/20826 155 | [20853]: https://github.com/PowerShell/PowerShell/pull/20853 156 | [20910]: https://github.com/PowerShell/PowerShell/pull/20910 157 | [20913]: https://github.com/PowerShell/PowerShell/pull/20913 158 | [20925]: https://github.com/PowerShell/PowerShell/pull/20925 159 | [20942]: https://github.com/PowerShell/PowerShell/pull/20942 160 | [20994]: https://github.com/PowerShell/PowerShell/pull/20994 161 | [21000]: https://github.com/PowerShell/PowerShell/pull/21000 162 | [21040]: https://github.com/PowerShell/PowerShell/pull/21040 163 | [21085]: https://github.com/PowerShell/PowerShell/pull/21085 164 | [21126]: https://github.com/PowerShell/PowerShell/pull/21126 165 | [21162]: https://github.com/PowerShell/PowerShell/pull/21162 166 | [21169]: https://github.com/PowerShell/PowerShell/pull/21169 167 | [21182]: https://github.com/PowerShell/PowerShell/pull/21182 168 | [21184]: https://github.com/PowerShell/PowerShell/pull/21184 169 | [21223]: https://github.com/PowerShell/PowerShell/pull/21223 170 | [21302]: https://github.com/PowerShell/PowerShell/pull/21302 171 | [21358]: https://github.com/PowerShell/PowerShell/pull/21358 172 | [21529]: https://github.com/PowerShell/PowerShell/pull/21529 173 | -------------------------------------------------------------------------------- /Microsoft.PowerShell.WhatsNew/relnotes/What-s-New-in-PowerShell-Core-60.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: What's New in PowerShell Core 6.0 3 | description: New features and changes released in PowerShell Core 6.0 4 | ms.date: 08/06/2018 5 | --- 6 | 7 | # What's New in PowerShell Core 6.0 8 | 9 | [PowerShell Core 6.0][github] is a new edition of PowerShell that is cross-platform (Windows, macOS, 10 | and Linux), open-source, and built for heterogeneous environments and the hybrid cloud. 11 | 12 | ## Moved from .NET Framework to .NET Core 13 | 14 | PowerShell Core uses [.NET Core 2.0][] as its runtime. .NET Core 2.0 enables PowerShell Core to work 15 | on multiple platforms (Windows, macOS, and Linux). PowerShell Core also exposes the API set offered 16 | by .NET Core 2.0 to be used in PowerShell cmdlets and scripts. 17 | 18 | Windows PowerShell used the .NET Framework runtime to host the PowerShell engine. This means that 19 | Windows PowerShell exposes the API set offered by .NET Framework. 20 | 21 | The APIs shared between .NET Core and .NET Framework are defined as part of [.NET Standard][]. 22 | 23 | For more information on how this affects module/script compatibility between PowerShell Core and 24 | Windows PowerShell, see 25 | [Backwards compatibility with Windows PowerShell](#backwards-compatibility-with-windows-powershell). 26 | 27 | ## Support for macOS and Linux 28 | 29 | PowerShell now officially supports macOS and Linux, including: 30 | 31 | - Windows 7, 8.1, and 10 32 | - Windows Server 2008 R2, 2012 R2, 2016 33 | - [Windows Server Semi-Annual Channel][semi-annual] 34 | - Ubuntu 14.04, 16.04, and 17.04 35 | - Debian 8.7+, and 9 36 | - CentOS 7 37 | - Red Hat Enterprise Linux 7 38 | - OpenSUSE 42.2 39 | - Fedora 25, 26 40 | - macOS 10.12+ 41 | 42 | Our community has also contributed packages for the following platforms, 43 | but they are not officially supported: 44 | 45 | - Arch Linux 46 | - Kali Linux 47 | - AppImage (works on multiple Linux platforms) 48 | 49 | We also have experimental (unsupported) releases for the following platforms: 50 | 51 | - Windows on ARM32/ARM64 52 | - Raspbian (Stretch) 53 | 54 | A number of changes were made to in PowerShell Core 6.0 to make it work better on non-Windows 55 | systems. Some of these are breaking changes, which also affect Windows. Others are only present or 56 | applicable in non-Windows installations of PowerShell Core. 57 | 58 | - Added support for native command globbing on Unix platforms. 59 | - The `more` functionality respects the Linux `$PAGER` and defaults to `less`. This means you can 60 | now use wildcards with native binaries/commands (for example, `ls *.txt`). (#3463) 61 | - Trailing backslash is automatically escaped when dealing with native command arguments. (#4965) 62 | - Ignore the `-ExecutionPolicy` switch when running PowerShell on non-Windows platforms because 63 | script signing is not currently supported. (#3481) 64 | - Fixed ConsoleHost to honor `NoEcho` on Unix platforms. (#3801) 65 | - Fixed `Get-Help` to support case insensitive pattern matching on Unix platforms. (#3852) 66 | - `powershell` man-page added to package 67 | 68 | ### Logging 69 | 70 | On macOS, PowerShell uses the native `os_log` APIs to log to Apple's 71 | [unified logging system][os_log]. On Linux, PowerShell uses [Syslog][], a ubiquitous logging 72 | solution. 73 | 74 | ### Filesystem 75 | 76 | A number of changes have been made on macOS and Linux to support filename characters not 77 | traditionally supported on Windows: 78 | 79 | - Paths given to cmdlets are now slash-agnostic (both / and \ work as directory separator) 80 | - XDG Base Directory Specification is now respected and used by default: 81 | - The Linux/macOS profile path is located at `~/.config/powershell/profile.ps1` 82 | - The history save path is located at 83 | `~/.local/share/powershell/PSReadline/ConsoleHost_history.txt` 84 | - The user module path is located at `~/.local/share/powershell/Modules` 85 | - Support for file and folder names containing the colon character on Unix. (#4959) 86 | - Support for script names or full paths that have commas. (#4136) (Thanks to 87 | [@TimCurwick](https://github.com/TimCurwick)!) 88 | - Detect when `-LiteralPath` is used to suppress wildcard expansion for navigation cmdlets. (#5038) 89 | - Updated `Get-ChildItem` to work more like the *nix `ls -R` and the Windows `DIR /S` native 90 | commands. `Get-ChildItem` now returns the symbolic links encountered during a recursive search and 91 | does not search the directories that those links target. (#3780) 92 | 93 | ### Case sensitivity 94 | 95 | Linux and macOS tend to be case-sensitive while Windows is case-insensitive while preserving case. 96 | In general, PowerShell is case insensitive. 97 | 98 | For example, environment variables are case-sensitive on macOS and Linux, so the casing of the 99 | `PSModulePath` environment variable has been standardized. (#3255) `Import-Module` is case 100 | insensitive when it's using a file path to determine the module's name. (#5097) 101 | 102 | ## Support for side-by-side installations 103 | 104 | PowerShell Core is installed, configured, and executed separately from Windows PowerShell. 105 | PowerShell Core has a "portable" ZIP package. Using the ZIP package, you can install any number of 106 | versions anywhere on disk, including local to an application that takes PowerShell as a dependency. 107 | Side-by-side installation makes it easier to test new versions of PowerShell and migrating existing 108 | scripts over time. Side-by-side also enables backwards compatibility as scripts can be pinned to 109 | specific versions that they require. 110 | 111 | > [!NOTE] 112 | > By default, the MSI-based installer on Windows does an in-place update install. 113 | 114 | ## Renamed `powershell(.exe)` to `pwsh(.exe)` 115 | 116 | The binary name for PowerShell Core has been changed from `powershell(.exe)` to `pwsh(.exe)`. This 117 | change provides a deterministic way for users to run PowerShell Core on machines to support 118 | side-by-side Windows PowerShell and PowerShell Core installations. `pwsh` is also much shorter and 119 | easier to type. 120 | 121 | Additional changes to `pwsh(.exe)` from `powershell.exe`: 122 | 123 | - Changed the first positional parameter from `-Command` to `-File`. This change fixes the usage of 124 | `#!` (aka as a shebang) in PowerShell scripts that are being executed from non-PowerShell shells 125 | on non-Windows platforms. It also means that you can run commands like `pwsh foo.ps1` or 126 | `pwsh fooScript` without specifying `-File`. However, this change requires that you explicitly 127 | specify `-c` or `-Command` when trying to run commands like `pwsh.exe -Command Get-Command`. 128 | (#4019) 129 | - PowerShell Core accepts the `-i` (or `-Interactive`) switch to indicate an interactive shell. 130 | (#3558) This allows PowerShell to be used as a default shell on Unix platforms. 131 | - Removed parameters `-importsystemmodules` and `-psconsoleFile` from `pwsh.exe`. (#4995) 132 | - Changed `pwsh -version` and built-in help for `pwsh.exe` to align with other native tools. (#4958 133 | & #4931) (Thanks [@iSazonov](https://github.com/iSazonov)) 134 | - Invalid argument error messages for `-File` and `-Command` and exit codes consistent with Unix 135 | standards (#4573) 136 | - Added `-WindowStyle` parameter on Windows. (#4573) Similarly, package-based installations updates 137 | on non-Windows platforms are in-place updates. 138 | 139 | ## Backwards compatibility with Windows PowerShell 140 | 141 | The goal of PowerShell Core is to remain as compatible as possible with Windows PowerShell. 142 | PowerShell Core uses [.NET Standard][] 2.0 to provide binary compatibility with existing .NET 143 | assemblies. Many PowerShell modules depend on these assemblies (often times DLLs), so .NET Standard 144 | allows them to continue working with .NET Core. PowerShell Core also includes a heuristic to look in 145 | well-known folders--like where the Global Assembly Cache typically resides on disk--to find .NET 146 | Framework DLL dependencies. 147 | 148 | You can learn more about .NET Standard on the [.NET Blog][], in this [YouTube][] video, and via this 149 | [FAQ][] on GitHub. 150 | 151 | Best efforts have been made to ensure that the PowerShell language and "built-in" modules (like 152 | `Microsoft.PowerShell.Management`, `Microsoft.PowerShell.Utility`, etc.) work the same as they do in 153 | Windows PowerShell. In many cases, with the help of the community, we've added new capabilities and 154 | bug fixes to those cmdlets. In some cases, due to a missing dependency in underlying .NET layers, 155 | functionality was removed or is unavailable. 156 | 157 | Most of the modules that ship as part of Windows (for example, `DnsClient`, `Hyper-V`, `NetTCPIP`, 158 | `Storage`, etc.) and other Microsoft products including Azure and Office have not been *explicitly* 159 | ported to .NET Core yet. The PowerShell team is working with these product groups and teams to 160 | validate and port their existing modules to PowerShell Core. With .NET Standard and [CDXML][], many 161 | of these traditional Windows PowerShell modules do seem to work in PowerShell Core, but they have 162 | not been formally validated, and they are not formally supported. 163 | 164 | By installing the [`WindowsPSModulePath`][windowspsmodulepath] module, you can use Windows 165 | PowerShell modules by appending the Windows PowerShell `PSModulePath` to your PowerShell Core 166 | `PSModulePath`. 167 | 168 | First, install the `WindowsPSModulePath` module from the PowerShell Gallery: 169 | 170 | ```powershell 171 | # Add `-Scope CurrentUser` if you're installing as non-admin 172 | Install-Module WindowsPSModulePath -Force 173 | ``` 174 | 175 | After installing this module, run the `Add-WindowsPSModulePath` cmdlet to add the Windows PowerShell 176 | `PSModulePath` to PowerShell Core: 177 | 178 | ```powershell 179 | # Add this line to your profile if you always want Windows PowerShell PSModulePath 180 | Add-WindowsPSModulePath 181 | ``` 182 | 183 | ## Docker support 184 | 185 | PowerShell Core adds support for Docker containers for all the major platforms we support (including 186 | multiple Linux distros, Windows Server Core, and Nano Server). 187 | 188 | For a complete list, check out the tags on [`microsoft/powershell` on Docker Hub][docker-hub]. For 189 | more information on Docker and PowerShell Core, see [Docker][] on GitHub. 190 | 191 | ## SSH-based PowerShell Remoting 192 | 193 | The PowerShell Remoting Protocol (PSRP) now works with the Secure Shell (SSH) protocol in addition 194 | to the traditional WinRM-based PSRP. 195 | 196 | This means that you can use cmdlets like `Enter-PSSession` and `New-PSSession` and authenticate 197 | using SSH. All you have to do is register PowerShell as a subsystem with an OpenSSH-based SSH 198 | server, and you can use your existing SSH-based authenticate mechanisms (like passwords or private 199 | keys) with the traditional `PSSession` semantics. 200 | 201 | For more information on configuring and using SSH-based remoting, 202 | see [PowerShell Remoting over SSH][ssh-remoting]. 203 | 204 | ## Default encoding is UTF-8 without a BOM except for New-ModuleManifest 205 | 206 | In the past, Windows PowerShell cmdlets like `Get-Content`, `Set-Content` used different encodings, 207 | such as ASCII and UTF-16. The variance in encoding defaults created problems when mixing cmdlets 208 | without specifying an encoding. 209 | 210 | Non-Windows platforms traditionally use UTF-8 without a Byte Order Mark (BOM) as the default 211 | encoding for text files. More Windows applications and tools are moving away from UTF-16 and towards 212 | BOM-less UTF-8 encoding. PowerShell Core changes the default encoding to conform with the broader 213 | ecosystems. 214 | 215 | This means that all built-in cmdlets that use the `-Encoding` parameter use the `UTF8NoBOM` value by 216 | default. The following cmdlets are affected by this change: 217 | 218 | - Add-Content 219 | - Export-Clixml 220 | - Export-Csv 221 | - Export-PSSession 222 | - Format-Hex 223 | - Get-Content 224 | - Import-Csv 225 | - Out-File 226 | - Select-String 227 | - Send-MailMessage 228 | - Set-Content 229 | 230 | These cmdlets have also been updated so that the `-Encoding` parameter universally accepts 231 | `System.Text.Encoding`. 232 | 233 | The default value of `$OutputEncoding` has also been changed to UTF-8. 234 | 235 | As a best practice, you should explicitly set encodings in scripts using the `-Encoding` parameter 236 | to produce deterministic behavior across platforms. 237 | 238 | `New-ModuleManifest` cmdlet does not have **Encoding** parameter. The encoding of the module 239 | manifest (.psd1) file created with `New-ModuleManifest` cmdlet depends on environment: if it is 240 | PowerShell Core running on Linux then encoding is UTF-8 (no BOM); otherwise encoding is UTF-16 (with 241 | BOM). (#3940) 242 | 243 | ## Support backgrounding of pipelines with ampersand (`&`) (#3360) 244 | 245 | Putting `&` at the end of a pipeline causes the pipeline to be run as a PowerShell job. When a 246 | pipeline is backgrounded, a job object is returned. Once the pipeline is running as a job, all of 247 | the standard `*-Job` cmdlets can be used to manage the job. Variables (ignoring process-specific 248 | variables) used in the pipeline are automatically copied to the job so `Copy-Item $foo $bar &` just 249 | works. The job is also run in the current directory instead of the user's home directory. For more 250 | information about PowerShell jobs, see 251 | [about_Jobs](/powershell/module/microsoft.powershell.core/about/about_jobs). 252 | 253 | ## Semantic versioning 254 | 255 | - Made `SemanticVersion` compatible with `SemVer 2.0`. (#5037) (Thanks 256 | [@iSazonov](https://github.com/iSazonov)!) 257 | - Changed default `ModuleVersion` in `New-ModuleManifest` to `0.0.1` to align with SemVer. (#4842) 258 | (Thanks [@LDSpits](https://github.com/LDSpits)) 259 | - Added `semver` as a type accelerator for `System.Management.Automation.SemanticVersion`. (#4142) 260 | (Thanks to [@oising](https://github.com/oising)!) 261 | - Enabled comparison between a `SemanticVersion` instance and a `Version` instance that is 262 | constructed only with `Major` and `Minor` version values. 263 | 264 | ## Language updates 265 | 266 | - Implement Unicode escape parsing so that users can use Unicode characters as arguments, strings, 267 | or variable names. (#3958) (Thanks to [@rkeithhill](https://github.com/rkeithhill)!) 268 | - Added new escape character for ESC: `` `e`` 269 | - Added support for converting enums to string (#4318) (Thanks 270 | [@KirkMunro](https://github.com/KirkMunro)) 271 | - Fixed casting single element array to a generic collection. (#3170) 272 | - Added character range overload to the `..` operator, so `'a'..'z'` returns characters from 'a' to 273 | 'z'. (#5026) (Thanks [@IISResetMe](https://github.com/IISResetMe)!) 274 | - Fixed variable assignment to not overwrite read-only variables 275 | - Push locals of automatic variables to 'DottedScopes' when dotting script cmdlets (#4709) 276 | - Enable use of 'Singleline, Multiline' option in split operator (#4721) (Thanks 277 | [@iSazonov](https://github.com/iSazonov)) 278 | 279 | ## Engine updates 280 | 281 | - `$PSVersionTable` has four new properties: 282 | - `PSEdition`: This is set to `Core` on PowerShell Core and `Desktop` on Windows PowerShell 283 | - `GitCommitId`: This is the Git commit ID of the Git branch or tag where PowerShell was built. 284 | On released builds, it will likely be the same as `PSVersion`. 285 | - `OS`: This is an OS version string returned by 286 | `[System.Runtime.InteropServices.RuntimeInformation]::OSDescription` 287 | - `Platform`: This is returned by `[System.Environment]::OSVersion.Platform` 288 | It is set to `Win32NT` on Windows, `Unix` on macOS, and `Unix` on Linux. 289 | - Removed the `BuildVersion` property from `$PSVersionTable`. This property was strongly tied to the 290 | Windows build version. Instead, we recommend that you use `GitCommitId` to retrieve the exact 291 | build version of PowerShell Core. (#3877) (Thanks to [@iSazonov](https://github.com/iSazonov)!) 292 | - Remove `ClrVersion` property from `$PSVersionTable`. This property is irrelevant for .NET Core, 293 | and was only preserved in .NET Core for specific legacy purposes that are inapplicable to 294 | PowerShell. 295 | - Added three new automatic variables to determine whether PowerShell is running in a given OS: 296 | `$IsWindows`, `$IsMacOs`, and `$IsLinux`. 297 | - Add `GitCommitId` to PowerShell Core banner. Now you don't have to run `$PSVersionTable` as soon 298 | as you start PowerShell to get the version! (#3916) (Thanks to 299 | [@iSazonov](https://github.com/iSazonov)!) 300 | - Add a JSON config file called `powershell.config.json` in `$PSHome` to store some settings 301 | required before startup time (e.g. `ExecutionPolicy`). 302 | - Don't block pipeline when running Windows EXE's 303 | - Enabled enumeration of COM collections. (#4553) 304 | 305 | ## Cmdlet updates 306 | 307 | ### New cmdlets 308 | 309 | - Add `Get-Uptime` to `Microsoft.PowerShell.Utility`. 310 | - Add `Remove-Alias` Command. (#5143) (Thanks [@PowershellNinja](https://github.com/PowershellNinja)!) 311 | - Add `Remove-Service` to Management module. (#4858) (Thanks [@joandrsn](https://github.com/joandrsn)!) 312 | 313 | ### Web cmdlets 314 | 315 | - Add certificate authentication support for web cmdlets. (#4646) (Thanks 316 | [@markekraus](https://github.com/markekraus)) 317 | - Add support for content headers to web cmdlets. (#4494 & #4640) (Thanks 318 | [@markekraus](https://github.com/markekraus)) 319 | - Add multiple link header support to Web Cmdlets. (#5265) (Thanks 320 | [@markekraus](https://github.com/markekraus)!) 321 | - Support Link header pagination in web cmdlets (#3828) 322 | - For `Invoke-WebRequest`, when the response includes a Link header we create a RelationLink 323 | property as a Dictionary representing the URLs and `rel` attributes and ensure the URLs are 324 | absolute to make it easier for the developer to use. 325 | - For `Invoke-RestMethod`, when the response includes a Link header we expose a `-FollowRelLink` 326 | switch to automatically follow `next` `rel` links until they no longer exist or once we hit the 327 | optional `-MaximumFollowRelLink` parameter value. 328 | - Add `-CustomMethod` parameter to web cmdlets to allow for non-standard method verbs. (#3142) 329 | (Thanks to @Lee303!) 330 | - Add `SslProtocol` support to Web Cmdlets. (#5329) (Thanks 331 | [@markekraus](https://github.com/markekraus)!) 332 | - Add Multipart support to web cmdlets. (#4782) (Thanks [@markekraus](https://github.com/markekraus)) 333 | - Add `-NoProxy` to web cmdlets so that they ignore the system-wide proxy setting. (#3447) (Thanks 334 | to [@TheFlyingCorpse](https://github.com/TheFlyingCorpse)!) 335 | - User Agent of Web Cmdlets now reports the OS platform (#4937) (Thanks 336 | [@LDSpits](https://github.com/LDSpits)) 337 | - Add `-SkipHeaderValidation` switch to web cmdlets to support adding headers without validating the 338 | header value. (#4085) 339 | - Enable web cmdlets to not validate the HTTPS certificate of the server if required. 340 | - Add authentication parameters to web cmdlets. (#5052) (Thanks 341 | [@markekraus](https://github.com/markekraus)) 342 | - Add `-Authentication` that provides three options: Basic, OAuth, and Bearer. 343 | - Add `-Token` to get the bearer token for OAuth and Bearer options. 344 | - Add `-AllowUnencryptedAuthentication` to bypass authentication that is provided for any 345 | transport scheme other than HTTPS. 346 | - Add `-ResponseHeadersVariable` to `Invoke-RestMethod` to enable the capture of response headers. 347 | (#4888) (Thanks [@markekraus](https://github.com/markekraus)) 348 | - Fix web cmdlets to include the HTTP response in the exception when the response status code is not 349 | success. (#3201) 350 | - Change web cmdlets `UserAgent` from `WindowsPowerShell` to `PowerShell`. (#4914) (Thanks 351 | [@markekraus](https://github.com/markekraus)) 352 | - Add explicit `ContentType` detection to `Invoke-RestMethod` (#4692) 353 | - Fix web cmdlets `-SkipHeaderValidation` to work with non-standard User-Agent headers. (#4479 & 354 | #4512) (Thanks [@markekraus](https://github.com/markekraus)) 355 | 356 | ### JSON cmdlets 357 | 358 | - Add `-AsHashtable` to `ConvertFrom-Json` to return a `Hashtable` instead. (#5043) (Thanks 359 | [@bergmeister](https://github.com/bergmeister)!) 360 | - Use prettier formatter with `ConvertTo-Json` output. (#2787) (Thanks to @kittholland!) 361 | - Add `Jobject` serialization support to `ConvertTo-Json`. (#5141) 362 | - Fix `ConvertFrom-Json` to deserialize an array of strings from the pipeline that together 363 | construct a complete JSON string. This fixes some cases where newlines would break JSON parsing. 364 | (#3823) 365 | - Remove the `AliasProperty "Count"` defined for `System.Array`. This removes the extraneous `Count` 366 | property on some `ConvertFrom-Json` output. (#3231) (Thanks to 367 | [@PetSerAl](https://github.com/PetSerAl)!) 368 | 369 | ### CSV cmdlets 370 | 371 | - `Import-Csv` now supports the W3C Extended Log File Format (#2482) (Thanks 372 | [@iSazonov](https://github.com/iSazonov)!) 373 | - Add `PSTypeName` Support for `Import-Csv` and `ConvertFrom-Csv`. (#5389) (Thanks 374 | [@markekraus](https://github.com/markekraus)!) 375 | - Make `Import-Csv` support `CR`, `LF`, and `CRLF` as line delimiters. (#5363) (Thanks 376 | [@iSazonov](https://github.com/iSazonov)!) 377 | - Make `-NoTypeInformation` the default on `Export-Csv` and `ConvertTo-Csv`. (#5164) (Thanks 378 | [@markekraus](https://github.com/markekraus)!) 379 | 380 | ### Service cmdlets 381 | 382 | - Add properties `UserName`, `Description`, `DelayedAutoStart`, `BinaryPathName`, and `StartupType` 383 | to the `ServiceController` objects returned by `Get-Service`. (#4907) (Thanks 384 | [@joandrsn](https://github.com/joandrsn)) 385 | - Add functionality to set credentials on `Set-Service` command. (#4844) (Thanks 386 | [@joandrsn](https://github.com/joandrsn)) 387 | 388 | ### Other cmdlets 389 | 390 | - Add a parameter to `Get-ChildItem` called `-FollowSymlink` that traverses symlinks on demand, with 391 | checks for link loops. (#4020) 392 | - Update `Add-Type` to support `CSharpVersion7`. (#3933) (Thanks to 393 | [@iSazonov](https://github.com/iSazonov)) 394 | - Remove the `Microsoft.PowerShell.LocalAccounts` module due to the use of unsupported APIs until a 395 | better solution is found. (#4302) 396 | - Remove the `*-Counter` cmdlets in `Microsoft.PowerShell.Diagnostics` due to the use of unsupported 397 | APIs until a better solution is found. (#4303) 398 | - Add support for `Invoke-Item -Path `. (#4262) 399 | - Add `-Extension` and `-LeafBase` switches to `Split-Path` so that you can split paths between the 400 | filename extension and the rest of the filename. (#2721) (Thanks to 401 | [@powercode](https://github.com/powercode)!) 402 | - Add parameters `-Top` and `-Bottom` to `Sort-Object` for Top/Bottom N sort 403 | - Expose a process' parent process by adding the `CodeProperty "Parent"` to 404 | `System.Diagnostics.Process`. (#2850) (Thanks to [@powercode](https://github.com/powercode)!) 405 | - Use MB instead of KB for memory columns of `Get-Process` 406 | - Add `-NoNewLine` switch for `Out-String`. (#5056) (Thanks 407 | [@raghav710](https://github.com/raghav710)) 408 | - `Move-Item` cmdlet honors `-Include`, `-Exclude`, and `-Filter` parameters. (#3878) 409 | - Allow `*` to be used in registry path for `Remove-Item`. (#4866) 410 | - Add `-Title` to `Get-Credential` and unify the prompt experience across platforms. 411 | - Add the `-TimeOut` parameter to `Test-Connection`. (#2492) 412 | - `Get-AuthenticodeSignature` cmdlets can now get file signature timestamp. (#4061) 413 | - Remove unsupported `-ShowWindow` switch from `Get-Help`. (#4903) 414 | - Fix `Get-Content -Delimiter` to not include the delimiter in the array elements returned (#3706) 415 | (Thanks [@mklement0](https://github.com/mklement0)) 416 | - Add `Meta`, `Charset`, and `Transitional` parameters to `ConvertTo-HTML` (#4184) (Thanks 417 | [@ergo3114](https://github.com/ergo3114)) 418 | - Add `WindowsUBR` and `WindowsVersion` properties to `Get-ComputerInfo` result 419 | - Add `-Group` parameter to `Get-Verb` 420 | - Add `ShouldProcess` support to `New-FileCatalog` and `Test-FileCatalog` (fixes `-WhatIf` and 421 | `-Confirm`). (#3074) (Thanks to [@iSazonov](https://github.com/iSazonov)!) 422 | - Add `-WhatIf` switch to `Start-Process` cmdlet (#4735) (Thanks 423 | [@sarithsutha](https://github.com/sarithsutha)) 424 | - Add `ValidateNotNullOrEmpty` too many existing parameters. 425 | 426 | ## Tab completion 427 | 428 | - Enhanced the type inference in tab completion based on runtime variable values. (#2744) (Thanks to 429 | [@powercode](https://github.com/powercode)!) This enables tab completion in situations like: 430 | 431 | ```powershell 432 | $p = Get-Process 433 | $p | Foreach-Object Prio 434 | ``` 435 | 436 | - Add Hashtable tab completion for `-Property` of `Select-Object`. (#3625) (Thanks to 437 | [@powercode](https://github.com/powercode)) 438 | - Enable argument auto-completion for `-ExcludeProperty` and `-ExpandProperty` of `Select-Object`. 439 | (#3443) (Thanks to [@iSazonov](https://github.com/iSazonov)!) 440 | - Fix a bug in tab completion to make `native.exe --` call into native completer. (#3633) 441 | (Thanks to [@powercode](https://github.com/powercode)!) 442 | 443 | We've introduced a number of breaking changes in PowerShell Core 6.0. 444 | To read more about them in detail, see [Breaking Changes in PowerShell Core 6.0][breaking-changes]. 445 | 446 | ## Debugging 447 | 448 | - Support for remote step-in debugging for `Invoke-Command -ComputerName`. (#3015) 449 | - Enable binder debug logging in PowerShell Core 450 | 451 | ## Filesystem updates 452 | 453 | - Enable usage of the Filesystem provider from a UNC path. ($4998) 454 | - `Split-Path` now works with UNC roots 455 | - `cd` with no arguments now behaves as `cd ~` 456 | - Fixed PowerShell Core to allow use of paths that are more than 260 characters long. (#3960) 457 | 458 | ## Bug fixes and performance improvements 459 | 460 | We've made *many* improvements to performance across PowerShell, including in startup time, various 461 | built-in cmdlets, and interaction with native binaries. 462 | 463 | We've also fixed a number of bugs within PowerShell Core. For a complete list of fixes and changes, 464 | check out our [changelog][] on GitHub. 465 | 466 | ## Telemetry 467 | 468 | - PowerShell Core 6.0 added telemetry to the console host to report two values (#3620): 469 | - the OS platform (`$PSVersionTable.OSDescription`) 470 | - the exact version of PowerShell (`$PSVersionTable.GitCommitId`) 471 | 472 | If you want to opt-out of this telemetry, simply create `POWERSHELL_TELEMETRY_OPTOUT` environment 473 | variable with one of the following values: `true`, `1` or `yes`. Creating the variable bypasses all 474 | telemetry even before the first run of PowerShell. We also plan on exposing this telemetry data and 475 | the insights we glean from the telemetry in the [community dashboard][community-dashboard]. You can 476 | find out more about how we use this data in this [blog post][telemetry-blog]. 477 | 478 | ## Breaking Changes for PowerShell 6.0 479 | 480 | ### Modules not shipped for PowerShell 6.0 481 | 482 | For various compatibility reasons, the following modules are not included in PowerShell 6. 483 | 484 | - ISE 485 | - Microsoft.PowerShell.LocalAccounts 486 | - Microsoft.PowerShell.ODataUtils 487 | - Microsoft.PowerShell.Operation.Validation 488 | - PSScheduledJob 489 | - PSWorkflow 490 | - PSWorkflowUtility 491 | 492 | ### PowerShell Workflow 493 | 494 | [PowerShell Workflow][workflow] is a feature in Windows PowerShell that builds on top of 495 | [Windows Workflow Foundation (WF)][workflow-foundation] that enables the creation of robust runbooks 496 | for long-running or parallelized tasks. 497 | 498 | Due to the lack of support for Windows Workflow Foundation in .NET Core, we are not supporting 499 | PowerShell Workflow in PowerShell Core. 500 | 501 | In the future, we would like to enable native parallelism/concurrency in the PowerShell language 502 | without the need for PowerShell Workflow. 503 | 504 | If there is a need to use checkpoints to resume a script after the OS restarts, we recommend 505 | using Task Scheduler to run a script on OS startup, but the script would need to maintain 506 | its own state (like persisting it to a file). 507 | 508 | [workflow]: /previous-versions/powershell/scripting/components/workflows-guide 509 | [workflow-foundation]: /dotnet/framework/windows-workflow-foundation/ 510 | 511 | ### Custom snap-ins 512 | 513 | [PowerShell snap-ins][snapin] are a predecessor to PowerShell modules that do not have widespread 514 | adoption in the PowerShell community. 515 | 516 | Due to the complexity of supporting snap-ins and their lack of usage in the community, we no longer 517 | support custom snap-ins in PowerShell Core. 518 | 519 | Today, this breaks the `ActiveDirectory` and `DnsClient` modules in Windows and Windows Server. 520 | 521 | [snapin]: /powershell/module/microsoft.powershell.core/about/about_pssnapins 522 | 523 | ### WMI v1 cmdlets 524 | 525 | Due to the complexity of supporting two sets of WMI-based modules, we removed the WMI v1 cmdlets 526 | from PowerShell Core: 527 | 528 | - `Register-WmiEvent` 529 | - `Set-WmiInstance` 530 | - `Invoke-WmiMethod` 531 | - `Get-WmiObject` 532 | - `Remove-WmiObject` 533 | 534 | Instead, we recommend that you the use the CIM (aka WMI v2) cmdlets which provide the same 535 | functionality with new functionality and a redesigned syntax: 536 | 537 | - `Get-CimAssociatedInstance` 538 | - `Get-CimClass` 539 | - `Get-CimInstance` 540 | - `Get-CimSession` 541 | - `Invoke-CimMethod` 542 | - `New-CimInstance` 543 | - `New-CimSession` 544 | - `New-CimSessionOption` 545 | - `Register-CimIndicationEvent` 546 | - `Remove-CimInstance` 547 | - `Remove-CimSession` 548 | - `Set-CimInstance` 549 | 550 | ### Microsoft.PowerShell.LocalAccounts 551 | 552 | Due to the use of unsupported APIs, `Microsoft.PowerShell.LocalAccounts` has been removed from 553 | PowerShell Core until a better solution is found. 554 | 555 | ### `New-WebServiceProxy` cmdlet removed 556 | 557 | .NET Core does not support the Windows Communication Framework, which provide services for using the 558 | SOAP protocol. This cmdlet was removed because it requires SOAP. 559 | 560 | ### `*-Transaction` cmdlets removed 561 | 562 | These cmdlets had very limited usage. The decision was made to discontinue support for them. 563 | 564 | - `Complete-Transaction` 565 | - `Get-Transaction` 566 | - `Start-Transaction` 567 | - `Undo-Transaction` 568 | - `Use-Transaction` 569 | 570 | ### Security cmdlets not available on non-Windows platforms 571 | 572 | - `Get-Acl` 573 | - `Set-Acl` 574 | - `Get-AuthenticodeSignature` 575 | - `Set-AuthenticodeSignature` 576 | - `Get-CmsMessage` 577 | - `Protect-CmsMessage` 578 | - `Unprotect-CmsMessage` 579 | - `New-FileCatalog` 580 | - `Test-FileCatalog` 581 | 582 | ### `*-Computer`and other Windows-specific cmdlets 583 | 584 | Due to the use of unsupported APIs, the following cmdlets have been removed from PowerShell Core 585 | until a better solution is found. 586 | 587 | - `Get-Clipboard` 588 | - `Set-Clipboard` 589 | - `Add-Computer` 590 | - `Checkpoint-Computer` 591 | - `Remove-Computer` 592 | - `Restore-Computer` 593 | - `Reset-ComputerMachinePassword` 594 | - `Disable-ComputerRestore` 595 | - `Enable-ComputerRestore` 596 | - `Get-ComputerRestorePoint` 597 | - `Test-ComputerSecureChannel` 598 | - `Get-ControlPanelItem` 599 | - `Show-ControlPanelItem` 600 | - `Get-HotFix` 601 | - `Clear-RecycleBin` 602 | - `Update-List` 603 | - `Out-Printer` 604 | - `ConvertFrom-String` 605 | - `Convert-String` 606 | 607 | ### `*-Counter` cmdlets 608 | 609 | Due to the use of unsupported APIs, the `*-Counter` has been removed from PowerShell Core until a 610 | better solution is found. 611 | 612 | ### `*-EventLog` cmdlets 613 | 614 | Due to the use of unsupported APIs, the `*-EventLog` has been removed from PowerShell Core. until a 615 | better solution is found. `Get-WinEvent` and `New-WinEvent` are available to get and create 616 | events on Windows. 617 | 618 | ### Cmdlets that use WPF removed 619 | 620 | The Windows Presentation Framework is not supported on CoreCLR. The following cmdlets are affected: 621 | 622 | - `Show-Command` 623 | - `Out-GridView` 624 | - The **showwindow** parameter of `Get-Help` 625 | 626 | ### Some DSC cmdlets removed 627 | 628 | - `Get-DscConfiguration` 629 | - `Publish-DscConfiguration` 630 | - `Restore-DscConfiguration` 631 | - `Start-DscConfiguration` 632 | - `Stop-DscConfiguration` 633 | - `Test-DscConfiguration` 634 | - `Update-DscConfiguration` 635 | - `Remove-DscConfigurationDocument` 636 | - `Get-DscConfigurationStatus` 637 | - `Disable-DscDebug` 638 | - `Enable-DscDebug` 639 | - `Get-DscLocalConfigurationManager` 640 | - `Set-DscLocalConfigurationManager` 641 | - `Invoke-DscResource` 642 | 643 | ## Engine/language changes 644 | 645 | ### Rename `powershell.exe` to `pwsh.exe` [#5101](https://github.com/PowerShell/PowerShell/issues/5101) 646 | 647 | In order to give users a deterministic way to call PowerShell Core on Windows (as opposed to 648 | Windows PowerShell), the PowerShell Core binary was changed to `pwsh.exe` on Windows and `pwsh` on 649 | non-Windows platforms. 650 | 651 | The shortened name is also consistent with naming of shells on non-Windows platforms. 652 | 653 | ### Don't insert line breaks to output (except for tables) [#5193](https://github.com/PowerShell/PowerShell/issues/5193) 654 | 655 | Previously, output was aligned to the width of the console and line breaks were added at the end 656 | width of the console, meaning the output didn't get reformatted as expected if the terminal was 657 | resized. This change was not applied to tables, as the line breaks are necessary to keep the columns 658 | aligned. 659 | 660 | ### Skip null-element check for collections with a value-type element type [#5432](https://github.com/PowerShell/PowerShell/issues/5432) 661 | 662 | For the `Mandatory` parameter and `ValidateNotNull` and `ValidateNotNullOrEmpty` attributes, skip 663 | the null-element check if the collection's element type is value type. 664 | 665 | ### Change `$OutputEncoding` to use `UTF-8 NoBOM` encoding rather than ASCII [#5369](https://github.com/PowerShell/PowerShell/issues/5369) 666 | 667 | The previous encoding, ASCII (7-bit), would result in incorrect alteration of the output in some 668 | cases. This change is to make `UTF-8 NoBOM` default, which preserves Unicode output with an encoding 669 | supported by most tools and operating systems. 670 | 671 | ### Remove `AllScope` from most default aliases [#5268](https://github.com/PowerShell/PowerShell/issues/5268) 672 | 673 | To speed up scope creation, `AllScope` was removed from most default aliases. `AllScope` was left 674 | for a few frequently used aliases where the lookup was faster. 675 | 676 | ### `-Verbose` and `-Debug` no longer overrides `$ErrorActionPreference` [#5113](https://github.com/PowerShell/PowerShell/issues/5113) 677 | 678 | Previously, if `-Verbose` or `-Debug` were specified, it overrode the behavior of 679 | `$ErrorActionPreference`. With this change, `-Verbose` and `-Debug` no longer affect the behavior 680 | of `$ErrorActionPreference`. 681 | 682 | ## Cmdlet changes 683 | 684 | ### Invoke-RestMethod doesn't return useful info when no data is returned. [#5320](https://github.com/PowerShell/PowerShell/issues/5320) 685 | 686 | When an API returns just `null`, Invoke-RestMethod was serializing this as the string `"null"` 687 | instead of `$null`. This change fixes the logic in `Invoke-RestMethod` to properly serialize a 688 | valid single value JSON `null` literal as `$null`. 689 | 690 | ### Remove `-Protocol` from `*-Computer` cmdlets [#5277](https://github.com/PowerShell/PowerShell/issues/5277) 691 | 692 | Due to issues with RPC remoting in CoreFX (particularly on non-Windows platforms) and ensuring a 693 | consistent remoting experience in PowerShell, the `-Protocol` parameter was removed from the 694 | `\*-Computer` cmdlets. DCOM is no longer supported for remoting. The following cmdlets only support 695 | WSMAN remoting: 696 | 697 | - Rename-Computer 698 | - Restart-Computer 699 | - Stop-Computer 700 | 701 | ### Remove `-ComputerName` from `*-Service` cmdlets [#5090](https://github.com/PowerShell/PowerShell/issues/5094) 702 | 703 | In order to encourage the consistent use of PSRP, the `-ComputerName` parameter was removed from 704 | `*-Service` cmdlets. 705 | 706 | ### Fix `Get-Item -LiteralPath a*b` if `a*b` doesn't actually exist to return error [#5197](https://github.com/PowerShell/PowerShell/issues/5197) 707 | 708 | Previously, `-LiteralPath` given a wildcard would treat it the same as `-Path` and if the wildcard 709 | found no files, it would silently exit. Correct behavior should be that `-LiteralPath` is literal 710 | so if the file doesn't exist, it should error. Change is to treat wildcards used with `-Literal` as 711 | literal. 712 | 713 | ### `Import-Csv` should apply `PSTypeNames` upon import when type information is present in the CSV [#5134](https://github.com/PowerShell/PowerShell/issues/5134) 714 | 715 | Previously, objects exported using `Export-CSV` with `TypeInformation` imported with 716 | `ConvertFrom-Csv` were not retaining the type information. This change adds the type information to 717 | `PSTypeNames` member if available from the CSV file. 718 | 719 | ### `-NoTypeInformation` should be default on `Export-Csv` [#5131](https://github.com/PowerShell/PowerShell/issues/5131) 720 | 721 | This change was made to address customer feedback on the default behavior of `Export-CSV` to 722 | include type information. 723 | 724 | Previously, the cmdlet would output a comment as the first line containing the type name of the 725 | object. The change is to suppress this by default as it's not understood by most tools. Use 726 | `-IncludeTypeInformation` to retain the previous behavior. 727 | 728 | ### Web Cmdlets should warn when `-Credential` is sent over unencrypted connections [#5112](https://github.com/PowerShell/PowerShell/issues/5112) 729 | 730 | When using HTTP, content including passwords are sent as clear-text. This change is to not allow 731 | this by default and return an error if credentials are being passed in an insecure manner. Users 732 | can bypass this by using the `-AllowUnencryptedAuthentication` switch. 733 | 734 | ## API changes 735 | 736 | ### Remove `AddTypeCommandBase` class [#5407](https://github.com/PowerShell/PowerShell/issues/5407) 737 | 738 | The `AddTypeCommandBase` class was removed from `Add-Type` to improve performance. This class is 739 | only used by the Add-Type cmdlet and should not impact users. 740 | 741 | ### Unify cmdlets with parameter `-Encoding` to be of type `System.Text.Encoding` [#5080](https://github.com/PowerShell/PowerShell/issues/5080) 742 | 743 | The `-Encoding` value `Byte` has been removed from the filesystem provider cmdlets. A new 744 | parameter, `-AsByteStream`, is now used to specify that a byte stream is required as input or that 745 | the output is a stream of bytes. 746 | 747 | ### Add better error message for empty and null `-UFormat` parameter [#5055](https://github.com/PowerShell/PowerShell/issues/5055) 748 | 749 | Previously, when passing an empty format string to `-UFormat`, an unhelpful error message would 750 | appear. A more descriptive error has been added. 751 | 752 | ### Clean up console code [#4995](https://github.com/PowerShell/PowerShell/issues/4995) 753 | 754 | The following features were removed as they are not supported in PowerShell Core, and there are no 755 | plans to add support as they exist for legacy reasons for Windows PowerShell: `-psconsolefile` 756 | switch and code, `-importsystemmodules` switch and code, and font changing code. 757 | 758 | ### Removed `RunspaceConfiguration` support [#4942](https://github.com/PowerShell/PowerShell/issues/4942) 759 | 760 | Previously, when creating a PowerShell runspace programmatically using the API you could use the 761 | legacy [`RunspaceConfiguration`][runspaceconfig] or the newer [`InitialSessionState`][iss]. This 762 | change removed support for `RunspaceConfiguration` and only supports `InitialSessionState`. 763 | 764 | [runspaceconfig]: /dotnet/api/system.management.automation.runspaces.runspaceconfiguration 765 | [iss]: /dotnet/api/system.management.automation.runspaces.initialsessionstate 766 | 767 | ### `CommandInvocationIntrinsics.InvokeScript` bind arguments to `$input` instead of `$args` [#4923](https://github.com/PowerShell/PowerShell/issues/4923) 768 | 769 | An incorrect position of a parameter resulted in the args passed as input instead of as args. 770 | 771 | ### Remove unsupported `-showwindow` switch from `Get-Help` [#4903](https://github.com/PowerShell/PowerShell/issues/4903) 772 | 773 | `-showwindow` relies on WPF, which is not supported on CoreCLR. 774 | 775 | ### Allow * to be used in registry path for `Remove-Item` [#4866](https://github.com/PowerShell/PowerShell/issues/4866) 776 | 777 | Previously, `-LiteralPath` given a wildcard would treat it the same as `-Path` and if the wildcard 778 | found no files, it would silently exit. Correct behavior should be that `-LiteralPath` is literal 779 | so if the file doesn't exist, it should error. Change is to treat wildcards used with `-Literal` as 780 | literal. 781 | 782 | ### Fix `Set-Service` failing test [#4802](https://github.com/PowerShell/PowerShell/issues/4802) 783 | 784 | Previously, if `New-Service -StartupType foo` was used, `foo` was ignored and the service was 785 | created with some default startup type. This change is to explicitly throw an error for an invalid 786 | startup type. 787 | 788 | ### Rename `$IsOSX` to `$IsMacOS` [#4700](https://github.com/PowerShell/PowerShell/issues/4700) 789 | 790 | The naming in PowerShell should be consistent with our naming and conform to Apple's use of macOS 791 | instead of OSX. However, for readability and consistently we are staying with Pascal casing. 792 | 793 | ### Make error message consistent when invalid script is passed to -File, better error when passed ambiguous argument [#4573](https://github.com/PowerShell/PowerShell/issues/4573) 794 | 795 | Change the exit codes of `pwsh.exe` to align with Unix conventions 796 | 797 | ### Removal of `LocalAccount` and cmdlets from `Diagnostics` modules. [#4302](https://github.com/PowerShell/PowerShell/issues/4302) [#4303](https://github.com/PowerShell/PowerShell/issues/4303) 798 | 799 | Due to unsupported APIs, the `LocalAccounts` module and the `Counter` cmdlets in the `Diagnostics` 800 | module were removed until a better solution is found. 801 | 802 | ### Executing PowerShell script with bool parameter does not work [#4036](https://github.com/PowerShell/PowerShell/issues/4036) 803 | 804 | Previously, using **powershell.exe** (now **pwsh.exe**) to execute a PowerShell script using `-File` 805 | provided no way to pass `$true`/`$false` as parameter values. Support for `$true`/`$false` as parsed 806 | values to parameters was added. Switch values are also supported as currently documented syntax 807 | doesn't work. 808 | 809 | ### Remove `ClrVersion` property from `$PSVersionTable` [#4027](https://github.com/PowerShell/PowerShell/issues/4027) 810 | 811 | The `ClrVersion` property of `$PSVersionTable` is not useful with CoreCLR, end users should not be 812 | using that value to determine compatibility. 813 | 814 | ### Change positional parameter for `powershell.exe` from `-Command` to `-File` [#4019](https://github.com/PowerShell/PowerShell/issues/4019) 815 | 816 | Enable shebang use of PowerShell on non-Windows platforms. This means on Unix based systems, you can 817 | make a script executable that would invoke PowerShell automatically rather than explicitly invoking 818 | `pwsh`. This also means that you can now do things like `powershell foo.ps1` or 819 | `powershell fooScript` without specifying `-File`. However, this change now requires that you 820 | explicitly specify `-c` or `-Command` when trying to do things like `powershell.exe Get-Command`. 821 | 822 | ### Implement Unicode escape parsing [#3958](https://github.com/PowerShell/PowerShell/issues/3958) 823 | 824 | `` `u####`` or `` `u{####}`` is converted to the corresponding Unicode character. To output a 825 | literal `` `u``, escape the backtick: ``` ``u```. 826 | 827 | ### Change `New-ModuleManifest` encoding to `UTF8NoBOM` on non-Windows platforms [#3940](https://github.com/PowerShell/PowerShell/issues/3940) 828 | 829 | Previously, `New-ModuleManifest` creates psd1 manifests in UTF-16 with BOM, creating a problem for 830 | Linux tools. This breaking change changes the encoding of `New-ModuleManifest` to be UTF (no BOM) in 831 | non-Windows platforms. 832 | 833 | ### Prevent `Get-ChildItem` from recursing into symlinks (#1875). [#3780](https://github.com/PowerShell/PowerShell/issues/3780) 834 | 835 | This change brings `Get-ChildItem` more in line with the Unix `ls -r` and the Windows `dir /s` 836 | native commands. Like the mentioned commands, the cmdlet displays symbolic links to directories 837 | found during recursion, but does not recurse into them. 838 | 839 | ### Fix `Get-Content -Delimiter` to not include the delimiter in the returned lines [#3706](https://github.com/PowerShell/PowerShell/issues/3706) 840 | 841 | Previously, the output while using `Get-Content -Delimiter` was inconsistent and inconvenient as it 842 | required further processing of the data to remove the delimiter. This change removes the delimiter 843 | in returned lines. 844 | 845 | ### Implement Format-Hex in C# [#3320](https://github.com/PowerShell/PowerShell/issues/3320) 846 | 847 | The `-Raw` parameter is now a "no-op" (in that it does nothing). Going forward all of the output 848 | will be displayed with a true representation of numbers that includes all of the bytes for its type 849 | (what the `-Raw` parameter was formally doing prior to this change). 850 | 851 | ### PowerShell as a default shell doesn't work with script command [#3319](https://github.com/PowerShell/PowerShell/issues/3319) 852 | 853 | On Unix, it is a convention for shells to accept `-i` for an interactive shell and many tools 854 | expect this behavior (`script` for example, and when setting PowerShell as the default shell) and 855 | calls the shell with the `-i` switch. This change is breaking in that `-i` previously could be used 856 | as short hand to match `-inputformat`, which now needs to be `-in`. 857 | 858 | ### Typo fix in Get-ComputerInfo property name [#3167](https://github.com/PowerShell/PowerShell/issues/3167) 859 | 860 | `BiosSerialNumber` was misspelled as `BiosSeralNumber` and has been changed to the correct spelling. 861 | 862 | ### Add `Get-StringHash` and `Get-FileHash` cmdlets [#3024](https://github.com/PowerShell/PowerShell/issues/3024) 863 | 864 | This change is that some hash algorithms are not supported by CoreFX, therefore they are no longer 865 | available: 866 | 867 | - `MACTripleDES` 868 | - `RIPEMD160` 869 | 870 | ### Add validation on `Get-*` cmdlets where passing $null returns all objects instead of error [#2672](https://github.com/PowerShell/PowerShell/issues/2672) 871 | 872 | Passing `$null` to any of the following now throws an error: 873 | 874 | - `Get-Credential -UserName` 875 | - `Get-Event -SourceIdentifier` 876 | - `Get-EventSubscriber -SourceIdentifier` 877 | - `Get-Help -Name` 878 | - `Get-PSBreakpoint -Script` 879 | - `Get-PSProvider -PSProvider` 880 | - `Get-PSSessionConfiguration -Name` 881 | - `Get-PSSnapin -Name` 882 | - `Get-Runspace -Name` 883 | - `Get-RunspaceDebug -RunspaceName` 884 | - `Get-Service -Name` 885 | - `Get-TraceSource -Name` 886 | - `Get-Variable -Name` 887 | - `Get-WmiObject -Class` 888 | - `Get-WmiObject -Property` 889 | 890 | ### Add support W3C Extended Log File Format in `Import-Csv` [#2482](https://github.com/PowerShell/PowerShell/issues/2482) 891 | 892 | Previously, the `Import-Csv` cmdlet cannot be used to directly import the log files in W3C extended 893 | log format and additional action would be required. With this change, W3C extended log format is 894 | supported. 895 | 896 | ### Parameter binding problem with `ValueFromRemainingArguments` in PS functions [#2035](https://github.com/PowerShell/PowerShell/issues/2035) 897 | 898 | `ValueFromRemainingArguments` now returns the values as an array instead of a single value which 899 | itself is an array. 900 | 901 | ### `BuildVersion` is removed from `$PSVersionTable` [#1415](https://github.com/PowerShell/PowerShell/issues/1415) 902 | 903 | Remove the `BuildVersion` property from `$PSVersionTable`. This property was tied to the Windows 904 | build version. Instead, we recommend that you use `GitCommitId` to retrieve the exact build version 905 | of PowerShell Core. 906 | 907 | ### Changes to Web Cmdlets 908 | 909 | The underlying .NET API of the Web Cmdlets has been changed to `System.Net.Http.HttpClient`. This 910 | change provides many benefits. However, this change along with a lack of interoperability with 911 | Internet Explorer have resulted in several breaking changes within `Invoke-WebRequest` and 912 | `Invoke-RestMethod`. 913 | 914 | - `Invoke-WebRequest` now supports basic HTML Parsing only. `Invoke-WebRequest` always returns a 915 | `BasicHtmlWebResponseObject` object. The `ParsedHtml` and `Forms` properties have been removed. 916 | - `BasicHtmlWebResponseObject.Headers` values are now `String[]` instead of `String`. 917 | - `BasicHtmlWebResponseObject.BaseResponse` is now a `System.Net.Http.HttpResponseMessage` object. 918 | - The `Response` property on Web Cmdlet exceptions is now a `System.Net.Http.HttpResponseMessage` 919 | object. 920 | - Strict RFC header parsing is now default for the `-Headers` and `-UserAgent` parameter. This can 921 | be bypassed with `-SkipHeaderValidation`. 922 | - `file://` and `ftp://` URI schemes are no longer supported. 923 | - `System.Net.ServicePointManager` settings are no longer honored. 924 | - There is currently no certificate based authentication available on macOS. 925 | - Use of `-Credential` over an `http://` URI will result in an error. Use an `https://` URI or 926 | supply the `-AllowUnencryptedAuthentication` parameter to suppress the error. 927 | - `-MaximumRedirection` now produces a terminating error when redirection attempts exceed the 928 | provided limit instead of returning the results of the last redirection. 929 | - In PowerShell 6.2, a change was made to default to UTF-8 encoding for JSON responses. When a 930 | charset is not supplied for a JSON response, the default encoding should be UTF-8 per RFC 8259. 931 | 932 | 933 | 934 | [.NET Blog]: https://devblogs.microsoft.com/dotnet/introducing-net-standard/ 935 | [.NET Core 2.0]: /dotnet/core/ 936 | [.NET Standard]: /dotnet/standard/net-standard 937 | [breaking-changes]: #breaking-changes-for-power-shell-60 938 | [CDXML]: /previous-versions/windows/desktop/wmi_v2/getting-started-with-cdxml 939 | [changelog]: https://github.com/PowerShell/PowerShell/tree/master/CHANGELOG.md 940 | [community-dashboard]: https://aka.ms/PSGitHubBI 941 | [docker-hub]: https://hub.docker.com/r/microsoft/powershell/ 942 | [docker]: https://github.com/PowerShell/PowerShell/tree/master/docker 943 | [FAQ]: https://github.com/dotnet/standard/blob/master/docs/faq.md 944 | [github]: https://github.com/PowerShell/PowerShell 945 | [os_log]: https://developer.apple.com/documentation/os/logging 946 | [semi-annual]: /windows-server/get-started/semi-annual-channel-overview 947 | [ssh-remoting]: /powershell/scripting/learn/remoting/SSH-Remoting-in-PowerShell-Core 948 | [Syslog]: https://en.wikipedia.org/wiki/Syslog 949 | [telemetry-blog]: https://devblogs.microsoft.com/powershell/powershell-open-source-community-dashboard/ 950 | [windowspsmodulepath]: https://www.powershellgallery.com/packages/WindowsPSModulePath/ 951 | [YouTube]: https://www.youtube.com/watch?v=YI4MurjfMn8&list=PLRAdsfhKI4OWx321A_pr-7HhRNk7wOLLY 952 | -------------------------------------------------------------------------------- /Microsoft.PowerShell.WhatsNew/relnotes/What-s-New-in-PowerShell-Core-61.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: What's New in PowerShell Core 6.1 3 | description: New features and changes released in PowerShell Core 6.1 4 | ms.date: 09/13/2018 5 | --- 6 | 7 | # What's New in PowerShell Core 6.1 8 | 9 | Below is a selection of some of the major new features and changes that have been introduced in 10 | PowerShell Core 6.1. 11 | 12 | There's also **tons** of "boring stuff" that make PowerShell faster and more stable (plus lots and 13 | lots of bug fixes)! For a full list of changes, check out our 14 | [changelog on GitHub](https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG.md). 15 | 16 | And while we call out some names below, thank you to 17 | [all of the community contributors](https://github.com/PowerShell/PowerShell/graphs/contributors) 18 | that made this release possible. 19 | 20 | ## .NET Core 2.1 21 | 22 | PowerShell Core 6.1 moved to .NET Core 2.1 after it was 23 | [released in May](https://devblogs.microsoft.com/dotnet/announcing-net-core-2-1/), resulting in a 24 | number of improvements to PowerShell, including: 25 | 26 | - performance improvements (see [below](#performance-improvements)) 27 | - Alpine Linux support (preview) 28 | - [.NET global tool support](/dotnet/core/tools/global-tools) - coming soon to PowerShell 29 | - [`Span`](/dotnet/api/system.span-1) 30 | 31 | ## Windows Compatibility Pack for .NET Core 32 | 33 | On Windows, the .NET team shipped the 34 | [Windows Compatibility Pack for .NET Core](https://devblogs.microsoft.com/dotnet/announcing-the-windows-compatibility-pack-for-net-core/), 35 | a set of assemblies that add a number of removed APIs back to .NET Core on Windows. 36 | 37 | We've added the Windows Compatibility Pack to PowerShell Core 6.1 release so that any modules or 38 | scripts that use these APIs can rely on them being available. 39 | 40 | The Windows Compatibility Pack enables PowerShell Core to use **more than 1900 cmdlets that ship 41 | with Windows 10 October 2018 Update and Windows Server 2019**. 42 | 43 | ## Support for Application allow lists 44 | 45 | PowerShell Core 6.1 has parity with Windows PowerShell 5.1 supporting 46 | [AppLocker](/windows/security/threat-protection/windows-defender-application-control/applocker/applocker-overview) 47 | and 48 | [Device Guard](/windows/security/threat-protection/device-guard/introduction-to-device-guard-virtualization-based-security-and-windows-defender-application-control) 49 | application allow lists. Application allow lists allow granular control of what binaries are 50 | allowed to be executed used with PowerShell 51 | [Constrained Language mode](https://devblogs.microsoft.com/powershell/powershell-constrained-language-mode/). 52 | 53 | ## Performance improvements 54 | 55 | PowerShell Core 6.0 made some significant performance improvements. PowerShell Core 6.1 continues to 56 | improve the speed of certain operations. 57 | 58 | For example, `Group-Object` has been sped up by 66%: 59 | 60 | ```powershell 61 | Measure-Command { 1..100000 | % {Get-Random -Minimum 1 -Maximum 10000} | Group-Object } 62 | ``` 63 | 64 | | Metric | Windows PowerShell 5.1 | PowerShell Core 6.0 | PowerShell Core 6.1 | 65 | | ------------ | ---------------------- | ------------------- | ------------------- | 66 | | Time (sec) | 25.178 | 19.653 | 6.641 | 67 | | Speed-up (%) | N/A | 21.9% | 66.2% | 68 | 69 | Similarly, sorting scenarios like this one have improved by more than 15%: 70 | 71 | ```powershell 72 | Measure-Command { 1..100000 | % {Get-Random -Minimum 1 -Maximum 10000} | Sort-Object } 73 | ``` 74 | 75 | | Metric | Windows PowerShell 5.1 | PowerShell Core 6.0 | PowerShell Core 6.1 | 76 | | ------------ | ---------------------- | ------------------- | ------------------- | 77 | | Time (sec) | 12.170 | 8.493 | 7.08 | 78 | | Speed-up (%) | N/A | 30.2% | 16.6% | 79 | 80 | `Import-Csv` has also been sped up significantly after a regression from Windows PowerShell. 81 | The following example uses a test CSV with 26,616 rows and six columns: 82 | 83 | ```powershell 84 | Measure-Command {$a = Import-Csv foo.csv} 85 | ``` 86 | 87 | | Metric | Windows PowerShell 5.1 | PowerShell Core 6.0 | PowerShell Core 6.1 | 88 | | ------------ | ---------------------- | ------------------- | ---------------------- | 89 | | Time (sec) | 0.441 | 1.069 | 0.268 | 90 | | Speed-up (%) | N/A | -142.4% | 74.9% (39.2% from WPS) | 91 | 92 | Lastly, conversion from JSON into `PSObject` has been sped up by more than 50% 93 | since Windows PowerShell. 94 | The following example uses a ~2MB test JSON file: 95 | 96 | ```powershell 97 | Measure-Command {Get-Content .\foo.json | ConvertFrom-Json} 98 | ``` 99 | 100 | | Metric | Windows PowerShell 5.1 | PowerShell Core 6.0 | PowerShell Core 6.1 | 101 | | ------------ | ---------------------- | ------------------- | ---------------------- | 102 | | Time (sec) | 0.259 | 0.577 | 0.125 | 103 | | Speed-up (%) | N/A | -122.8% | 78.3% (51.7% from WPS) | 104 | 105 | ## Check `system32` for compatible built-in modules on Windows 106 | 107 | In the Windows 10 1809 update and Windows Server 2019, we updated a number of built-in PowerShell 108 | modules to mark them as compatible with PowerShell Core. 109 | 110 | When PowerShell Core 6.1 starts up, it will automatically include `$windir\System32` as part of the 111 | `PSModulePath` environment variable. However, it only exposes modules to `Get-Module` and 112 | `Import-Module` if its `CompatiblePSEdition` is marked as compatible with `Core`. 113 | 114 | ```powershell 115 | Get-Module -ListAvailable 116 | ``` 117 | 118 | > [!NOTE] 119 | > You may see different available modules depending on what roles and features are installed. 120 | 121 | ```Output 122 | ... 123 | Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules 124 | 125 | ModuleType Version Name PSEdition ExportedCommands 126 | ---------- ------- ---- --------- ---------------- 127 | Manifest 2.0.1.0 Appx Core,Desk {Add-AppxPackage, Get-AppxPackage, Get-AppxPacka... 128 | Manifest 1.0.0.0 BitLocker Core,Desk {Unlock-BitLocker, Suspend-BitLocker, Resume-Bit... 129 | Manifest 1.0.0.0 DnsClient Core,Desk {Resolve-DnsName, Clear-DnsClientCache, Get-DnsC... 130 | Manifest 1.0.0.0 HgsDiagnostics Core,Desk {New-HgsTraceTarget, Get-HgsTrace, Get-HgsTraceF... 131 | Binary 2.0.0.0 Hyper-V Core,Desk {Add-VMAssignableDevice, Add-VMDvdDrive, Add-VMF... 132 | Binary 1.1 Hyper-V Core,Desk {Add-VMDvdDrive, Add-VMFibreChannelHba, Add-VMHa... 133 | Manifest 2.0.0.0 NetAdapter Core,Desk {Disable-NetAdapter, Disable-NetAdapterBinding, ... 134 | Manifest 1.0.0.0 NetEventPacketCapture Core,Desk {New-NetEventSession, Remove-NetEventSession, Ge... 135 | Manifest 2.0.0.0 NetLbfo Core,Desk {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-... 136 | Manifest 1.0.0.0 NetNat Core,Desk {Get-NetNat, Get-NetNatExternalAddress, Get-NetN... 137 | Manifest 2.0.0.0 NetQos Core,Desk {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQ... 138 | Manifest 2.0.0.0 NetSecurity Core,Desk {Get-DAPolicyChange, New-NetIPsecAuthProposal, N... 139 | Manifest 1.0.0.0 NetSwitchTeam Core,Desk {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-Ne... 140 | Manifest 1.0.0.0 NetWNV Core,Desk {Get-NetVirtualizationProviderAddress, Get-NetVi... 141 | Manifest 2.0.0.0 TrustedPlatformModule Core,Desk {Get-Tpm, Initialize-Tpm, Clear-Tpm, Unblock-Tpm... 142 | ... 143 | ``` 144 | 145 | You can override this behavior to show all modules using the `-SkipEditionCheck` switch parameter. 146 | We've also added a `PSEdition` property to the table output. 147 | 148 | ```powershell 149 | Get-Module Net* -ListAvailable -SkipEditionCheck 150 | ``` 151 | 152 | ```Output 153 | Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules 154 | 155 | ModuleType Version Name PSEdition ExportedCommands 156 | ---------- ------- ---- --------- ---------------- 157 | Manifest 2.0.0.0 NetAdapter Core,Desk {Disable-NetAdapter, Disable-NetAdapterBinding, ... 158 | Manifest 1.0.0.0 NetConnection Core,Desk {Get-NetConnectionProfile, Set-NetConnectionProf... 159 | Manifest 1.0.0.0 NetDiagnostics Desk Get-NetView 160 | Manifest 1.0.0.0 NetEventPacketCapture Core,Desk {New-NetEventSession, Remove-NetEventSession, Ge... 161 | Manifest 2.0.0.0 NetLbfo Core,Desk {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-... 162 | Manifest 1.0.0.0 NetNat Core,Desk {Get-NetNat, Get-NetNatExternalAddress, Get-NetN... 163 | Manifest 2.0.0.0 NetQos Core,Desk {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQ... 164 | Manifest 2.0.0.0 NetSecurity Core,Desk {Get-DAPolicyChange, New-NetIPsecAuthProposal, N... 165 | Manifest 1.0.0.0 NetSwitchTeam Core,Desk {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-Ne... 166 | Manifest 1.0.0.0 NetTCPIP Core,Desk {Get-NetIPAddress, Get-NetIPInterface, Get-NetIP... 167 | Manifest 1.0.0.0 NetWNV Core,Desk {Get-NetVirtualizationProviderAddress, Get-NetVi... 168 | Manifest 1.0.0.0 NetworkConnectivityStatus Core,Desk {Get-DAConnectionStatus, Get-NCSIPolicyConfigura... 169 | Manifest 1.0.0.0 NetworkSwitchManager Core,Desk {Disable-NetworkSwitchEthernetPort, Enable-Netwo... 170 | Manifest 1.0.0.0 NetworkTransition Core,Desk {Add-NetIPHttpsCertBinding, Disable-NetDnsTransi... 171 | ``` 172 | 173 | For more information about this behavior, check out 174 | [PowerShell RFC0025](https://github.com/PowerShell/PowerShell-RFC/blob/master/5-Final/RFC0025-PSCore6-and-Windows-Modules.md). 175 | 176 | ## Markdown cmdlets and rendering 177 | 178 | Markdown is a standard for creating readable plaintext documents with basic formatting that can be 179 | rendered into HTML. 180 | 181 | We've added some cmdlets in 6.1 that allow you to convert and render Markdown documents in the 182 | console, including: 183 | 184 | - `ConvertFrom-Markdown` 185 | - `Get-MarkdownOption` 186 | - `Set-MarkdownOption` 187 | - `Show-Markdown` 188 | 189 | For example, `Show-Markdown` renders a Markdown file in the console: 190 | 191 | ![Show-Markdown example](media/What-s-New-in-PowerShell-Core-61/markdown_example.png) 192 | 193 | For more information about how these cmdlets work, check out 194 | [this RFC](https://github.com/PowerShell/PowerShell-RFC/blob/master/5-Final/RFC0025-Native-Markdown-Rendering.md). 195 | 196 | ## Experimental feature flags 197 | 198 | We enabled support for [Experimental Features][]. This allows PowerShell developers to deliver new 199 | features and get feedback before the design is complete. This way we avoid making breaking changes 200 | as the design evolves. 201 | 202 | Use `Get-ExperimentalFeature` to get a list of available experimental features. You can enable or 203 | disable these features with `Enable-ExperimentalFeature` and `Disable-ExperimentalFeature`. 204 | 205 | You can learn more about this feature in 206 | [PowerShell RFC0029](https://github.com/PowerShell/PowerShell-RFC/blob/master/5-Final/RFC0029-Support-Experimental-Features.md). 207 | 208 | ## Web cmdlet improvements 209 | 210 | Thanks to [@markekraus](https://github.com/markekraus), a whole slew of improvements have been made to our web cmdlets: 211 | [`Invoke-WebRequest`](/powershell/module/microsoft.powershell.utility/invoke-webrequest) 212 | and [`Invoke-RestMethod`](/powershell/module/microsoft.powershell.utility/invoke-restmethod). 213 | 214 | - [PR #6109](https://github.com/PowerShell/PowerShell/pull/6109) - default encoding set to UTF-8 for 215 | `application-json` responses 216 | - [PR #6018](https://github.com/PowerShell/PowerShell/pull/6018) - `-SkipHeaderValidation` parameter 217 | to allow `Content-Type` headers that aren't standards-compliant 218 | - [PR #5972](https://github.com/PowerShell/PowerShell/pull/5972) - `Form` parameter to support 219 | simplified `multipart/form-data` support 220 | - [PR #6338](https://github.com/PowerShell/PowerShell/pull/6338) - Compliant, case-insensitive 221 | handling of relation keys 222 | - [PR #6447](https://github.com/PowerShell/PowerShell/pull/6447) - Add `-Resume` parameter for web 223 | cmdlets 224 | 225 | ## Remoting improvements 226 | 227 | ### PowerShell Direct for Containers tries to use PowerShell Core first 228 | 229 | [PowerShell Direct](/virtualization/hyper-v-on-windows/user-guide/powershell-direct) is a feature of 230 | PowerShell and Hyper-V that allows you to connect to a Hyper-V VM or Container without network 231 | connectivity or other remote management services. 232 | 233 | In the past, PowerShell Direct connected using the built-in Windows PowerShell instance on the 234 | Container. Now, PowerShell Direct first attempts to connect using any available `pwsh.exe` on the 235 | `PATH` environment variable. If `pwsh.exe` isn't available, PowerShell Direct falls back to use 236 | `powershell.exe`. 237 | 238 | ### `Enable-PSRemoting` now creates separate remoting endpoints for preview versions 239 | 240 | `Enable-PSRemoting` now creates two remoting session configurations: 241 | 242 | - One for the major version of PowerShell. For example, `PowerShell.6`. This endpoint that can be 243 | relied upon across minor version updates as the "system-wide" PowerShell 6 session configuration 244 | - One version-specific session configuration, for example: `PowerShell.6.1.0` 245 | 246 | This behavior is useful if you want to have multiple PowerShell 6 versions installed and accessible 247 | on the same machine. 248 | 249 | Additionally, preview versions of PowerShell now get their own 250 | remoting session configurations after running the `Enable-PSRemoting` cmdlet: 251 | 252 | ```powershell 253 | C:\WINDOWS\system32> Enable-PSRemoting 254 | ``` 255 | 256 | Your output may be different if you haven't set up WinRM before. 257 | 258 | ```Output 259 | WinRM is already set up to receive requests on this computer. 260 | WinRM is already set up for remote management on this computer. 261 | ``` 262 | 263 | Then you can see separate PowerShell session configurations for the preview and stable builds of 264 | PowerShell 6, and for each specific version. 265 | 266 | ```powershell 267 | Get-PSSessionConfiguration 268 | ``` 269 | 270 | ```Output 271 | Name : PowerShell.6.2-preview.1 272 | PSVersion : 6.2 273 | StartupScript : 274 | RunAsUser : 275 | Permission : NT AUTHORITY\INTERACTIVE AccessAllowed, BUILTIN\Administrators AccessAllowed, BUILTIN\Remote Management Users AccessAllowed 276 | 277 | Name : PowerShell.6-preview 278 | PSVersion : 6.2 279 | StartupScript : 280 | RunAsUser : 281 | Permission : NT AUTHORITY\INTERACTIVE AccessAllowed, BUILTIN\Administrators AccessAllowed, BUILTIN\Remote Management Users AccessAllowed 282 | 283 | Name : powershell.6 284 | PSVersion : 6.1 285 | StartupScript : 286 | RunAsUser : 287 | Permission : NT AUTHORITY\INTERACTIVE AccessAllowed, BUILTIN\Administrators AccessAllowed, BUILTIN\Remote Management Users AccessAllowed 288 | 289 | Name : powershell.6.1.0 290 | PSVersion : 6.1 291 | StartupScript : 292 | RunAsUser : 293 | Permission : NT AUTHORITY\INTERACTIVE AccessAllowed, BUILTIN\Administrators AccessAllowed, BUILTIN\Remote Management Users AccessAllowed 294 | ``` 295 | 296 | ### `user@host:port` syntax supported for SSH 297 | 298 | SSH clients typically support a connection string in the format `user@host:port`. With the addition 299 | of SSH as a protocol for PowerShell Remoting, we've added support for this format of connection 300 | string: 301 | 302 | `Enter-PSSession -HostName fooUser@ssh.contoso.com:2222` 303 | 304 | ## MSI option to add explorer shell context menu on Windows 305 | 306 | Thanks to [@bergmeister](https://github.com/bergmeister), now you can enable a context menu on 307 | Windows. Now you can open your system-wide installation of PowerShell 6.1 from any folder in the 308 | Windows Explorer: 309 | 310 | ![Shell context menu for PowerShell 6](media/What-s-New-in-PowerShell-Core-61/shell_context_menu.png) 311 | 312 | ## Goodies 313 | 314 | ### "Run as Administrator" in the Windows shortcut jump list 315 | 316 | Thanks to [@bergmeister](https://github.com/bergmeister), the PowerShell Core shortcut's jump list 317 | now includes "Run as Administrator": 318 | 319 | ![Run as administrator in the PowerShell 6 jump list](media/What-s-New-in-PowerShell-Core-61/jumplist.png) 320 | 321 | ### `cd -` returns to previous directory 322 | 323 | ```powershell 324 | C:\Windows\System32> cd C:\ 325 | C:\> cd - 326 | C:\Windows\System32> 327 | ``` 328 | 329 | Or on Linux: 330 | 331 | ```ShellSession 332 | PS /etc> cd /usr/bin 333 | PS /usr/bin> cd - 334 | PS /etc> 335 | ``` 336 | 337 | Also, `cd` and `cd --` change to `$HOME`. 338 | 339 | ### `Test-Connection` 340 | 341 | Thanks to [@iSazonov](https://github.com/iSazonov), the 342 | [`Test-Connection`](/powershell/module/microsoft.powershell.management/test-connection) cmdlet has 343 | been ported to PowerShell Core. 344 | 345 | ### `Update-Help` as non-admin 346 | 347 | By popular demand, `Update-Help` no longer needs to be run as an administrator. `Update-Help` now 348 | defaults to saving help to a user-scoped folder. 349 | 350 | ### New methods/properties on `PSCustomObject` 351 | 352 | Thanks to [@iSazonov](https://github.com/iSazonov), we've added new methods and properties to 353 | `PSCustomObject`. `PSCustomObject` now includes a `Count`/`Length` property like other objects. 354 | 355 | ```powershell 356 | $PSCustomObject = [pscustomobject]@{foo = 1} 357 | 358 | $PSCustomObject.Length 359 | ``` 360 | 361 | ```Output 362 | 1 363 | ``` 364 | 365 | ```powershell 366 | $PSCustomObject.Count 367 | ``` 368 | 369 | ```Output 370 | 1 371 | ``` 372 | 373 | This work also includes `ForEach` and `Where` methods that allow you to operate and filter on 374 | `PSCustomObject` items: 375 | 376 | ```powershell 377 | $PSCustomObject.ForEach({$_.foo + 1}) 378 | ``` 379 | 380 | ```Output 381 | 2 382 | ``` 383 | 384 | ```powershell 385 | $PSCustomObject.Where({$_.foo -gt 0}) 386 | ``` 387 | 388 | ```Output 389 | foo 390 | --- 391 | 1 392 | ``` 393 | 394 | ### `Where-Object -Not` 395 | 396 | Thanks to @SimonWahlin, we've added the `-Not` parameter to `Where-Object`. Now you can filter an 397 | object at the pipeline for the non-existence of a property, or a null/empty property value. 398 | 399 | For example, this command returns all services that don't have any dependent services defined: 400 | 401 | ```powershell 402 | Get-Service | Where-Object -Not DependentServices 403 | ``` 404 | 405 | ### `New-ModuleManifest` creates a BOM-less UTF-8 document 406 | 407 | Given our move to BOM-less UTF-8 in PowerShell 6.0, we've updated the `New-ModuleManifest` cmdlet to 408 | create a BOM-less UTF-8 document instead of a UTF-16 one. 409 | 410 | ### Conversions from PSMethod to Delegate 411 | 412 | Thanks to [@powercode](https://github.com/powercode), we now support the conversion of a `PSMethod` 413 | into a delegate. This allows you to do things like passing `PSMethod` `[M]::DoubleStrLen` as a 414 | delegate value into `[M]::AggregateString`: 415 | 416 | ```powershell 417 | class M { 418 | static [int] DoubleStrLen([string] $value) { return 2 * $value.Length } 419 | 420 | static [long] AggregateString([string[]] $values, [func[string, int]] $selector) { 421 | [long] $res = 0 422 | foreach($s in $values){ 423 | $res += $selector.Invoke($s) 424 | } 425 | return $res 426 | } 427 | } 428 | 429 | [M]::AggregateString((gci).Name, [M]::DoubleStrLen) 430 | ``` 431 | 432 | For more info on this change, check out [PR #5287](https://github.com/PowerShell/PowerShell/pull/5287). 433 | 434 | ### Standard deviation in `Measure-Object` 435 | 436 | Thanks to [@CloudyDino](https://github.com/CloudyDino), we've added a `StandardDeviation` property 437 | to `Measure-Object`: 438 | 439 | ```powershell 440 | Get-Process | Measure-Object -Property CPU -AllStats 441 | ``` 442 | 443 | ```Output 444 | Count : 308 445 | Average : 31.3720576298701 446 | Sum : 9662.59375 447 | Maximum : 4416.046875 448 | Minimum : 449 | StandardDeviation : 264.389544720926 450 | Property : CPU 451 | ``` 452 | 453 | ### `GetPfxCertificate -Password` 454 | 455 | Thanks to [@maybe-hello-world](https://github.com/maybe-hello-world), `Get-PfxCertificate` now has 456 | the `Password` parameter, which takes a `SecureString`. This allows you to use it non-interactively: 457 | 458 | ```powershell 459 | $certFile = '\\server\share\pwd-protected.pfx' 460 | $certPass = Read-Host -AsSecureString -Prompt 'Enter the password for certificate: ' 461 | 462 | $certThumbPrint = (Get-PfxCertificate -FilePath $certFile -Password $certPass ).ThumbPrint 463 | ``` 464 | 465 | ### Removal of the `more` function 466 | 467 | In the past, PowerShell shipped a function on Windows called `more` that wrapped `more.com`. That 468 | function has now been removed. 469 | 470 | Also, the `help` function changed to use `more.com` on Windows, or the system's default pager 471 | specified by `$env:PAGER` on non-Windows platforms. 472 | 473 | ### `cd DriveName:` now returns users to the current working directory in that drive 474 | 475 | Previously, using `Set-Location` or `cd` to return to a PSDrive sent users 476 | to the default location for that drive. 477 | 478 | Thanks to [@mcbobke](https://github.com/mcbobke), users are now sent to the last known current 479 | working directory for that session. 480 | 481 | ### Windows PowerShell type accelerators 482 | 483 | In Windows PowerShell, we included the following type accelerators to make it easier to work with 484 | their respective types: 485 | 486 | - `[adsi]`: `System.DirectoryServices.DirectoryEntry` 487 | - `[adsisearcher]`: `System.DirectoryServices.DirectorySearcher` 488 | - `[wmi]`: `System.Management.ManagementObject` 489 | - `[wmiclass]`: `System.Management.ManagementClass` 490 | - `[wmisearcher]`: `System.Management.ManagementObjectSearcher` 491 | 492 | These type accelerators were not included in PowerShell 6, but have been added to PowerShell 6.1 493 | running on Windows. 494 | 495 | These types are useful in easily constructing AD and WMI objects. 496 | 497 | For example, you can query using LDAP: 498 | 499 | ```powershell 500 | [adsi]'LDAP://CN=FooUse,OU=People,DC=contoso,DC=com' 501 | ``` 502 | 503 | Following example creates a Win32_OperatingSystem CIM object: 504 | 505 | ```powershell 506 | [wmi]"Win32_OperatingSystem=@" 507 | ``` 508 | 509 | ```Output 510 | SystemDirectory : C:\WINDOWS\system32 511 | Organization : Contoso IT 512 | BuildNumber : 18234 513 | RegisteredUser : Contoso Corp. 514 | SerialNumber : 12345-67890-ABCDE-F0123 515 | Version : 10.0.18234 516 | ``` 517 | 518 | This example returns a ManagementClass object for Win32_OperatingSystem class. 519 | 520 | ```powershell 521 | [wmiclass]"Win32_OperatingSystem" 522 | ``` 523 | 524 | ```Output 525 | NameSpace: ROOT\cimv2 526 | 527 | Name Methods Properties 528 | ---- ------- ---------- 529 | Win32_OperatingSystem {Reboot, Shutdown... {BootDevice, BuildNumber, BuildType, Caption...} 530 | ``` 531 | 532 | ### `-lp` alias for all `-LiteralPath` parameters 533 | 534 | Thanks to [@kvprasoon](https://github.com/kvprasoon), we now have a parameter alias `-lp` for all 535 | the built-in PowerShell cmdlets that have a `-LiteralPath` parameter. 536 | 537 | ## Breaking Changes 538 | 539 | ### MSI-based installation paths on Windows 540 | 541 | On Windows, the MSI package now installs to the following path: 542 | 543 | - `$env:ProgramFiles\PowerShell\6\` for the stable installation of 6.x 544 | - `$env:ProgramFiles\PowerShell\6-preview\` for the preview installation of 6.x 545 | 546 | This change ensures that PowerShell Core can be updated/serviced by Microsoft Update. 547 | 548 | For more information, check out 549 | [PowerShell RFC0026](https://github.com/PowerShell/PowerShell-RFC/blob/master/5-Final/RFC0026-MSI-Installation-Path.md). 550 | 551 | ### Telemetry can only be disabled with an environment variable 552 | 553 | PowerShell Core sends basic telemetry data to Microsoft when it is launched. The data includes the 554 | OS name, OS version, and PowerShell version. This data allows us to better understand the 555 | environments where PowerShell is used and enables us to prioritize new features and fixes. 556 | 557 | To opt-out of this telemetry, set the environment variable `POWERSHELL_TELEMETRY_OPTOUT` to `true`, 558 | `yes`, or `1`. We no longer support deletion of the file 559 | `DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY` to disable telemetry. 560 | 561 | ### Disallowed Basic Auth over HTTP in PowerShell Remoting on Unix platforms 562 | 563 | To prevent the use of unencrypted traffic, PowerShell Remoting on Unix platforms now requires usage 564 | of NTLM/Negotiate or HTTPS. 565 | 566 | For more information on these changes, check out 567 | [Issue #6779](https://github.com/PowerShell/PowerShell/issues/6779). 568 | 569 | ### Removed `VisualBasic` as a supported language in Add-Type 570 | 571 | In the past, you could compile Visual Basic code using the `Add-Type` cmdlet. Visual Basic was 572 | rarely used with `Add-Type`. We removed this feature to reduce the size of PowerShell. 573 | 574 | ### Cleaned up uses of `CommandTypes.Workflow` and `WorkflowInfoCleaned` 575 | 576 | For more information on these changes, check out 577 | [PR #6708](https://github.com/PowerShell/PowerShell/pull/6708). 578 | 579 | ### Group-Object now sorts the groups 580 | 581 | As part of the performance improvement, `Group-Object` now returns a sorted listing of the groups. 582 | Although you should not rely on the order, you could be broken by this change if you wanted the 583 | first group. We decided that this performance improvement was worth the change since the impact of 584 | being dependent on previous behavior is low. 585 | 586 | For more information on this change, see 587 | [Issue #7409](https://github.com/PowerShell/PowerShell/issues/7409). 588 | 589 | 590 | 591 | [Experimental Features]: /powershell/module/Microsoft.PowerShell.Core/About/about_Experimental_Features 592 | -------------------------------------------------------------------------------- /Microsoft.PowerShell.WhatsNew/relnotes/What-s-New-in-PowerShell-Core-62.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: What's New in PowerShell Core 6.2 3 | description: New features and changes released in PowerShell Core 6.2 4 | ms.date: 03/28/2019 5 | --- 6 | 7 | # What's New in PowerShell Core 6.2 8 | 9 | The PowerShell Core 6.2 release focused on performance improvements, bug fixes, and smaller cmdlet 10 | and language enhancements that improve the quality. To see a full list of improvements, check out 11 | our detailed [changelogs](https://github.com/PowerShell/PowerShell/releases) on GitHub. 12 | 13 | ## Experimental Features 14 | 15 | Previously, we enabled support for [Experimental Features][]. In the 6.2 release, we have four 16 | experimental features to try out. Please provide feedback so we can make improvements and to decide 17 | whether the feature is worth promoting to mainstream status. 18 | 19 | Use `Get-ExperimentalFeature` to get a list of available experimental features. You can enable or 20 | disable these features with `Enable-ExperimentalFeature` and `Disable-ExperimentalFeature`. 21 | 22 | ### Command Not Found Suggestions 23 | 24 | This feature uses fuzzy matching to find suggestions for commands or cmdlets you may have mistyped. 25 | 26 | ```powershell 27 | Enable-ExperimentalFeature -Name PSCommandNotFoundSuggestion 28 | ``` 29 | 30 | #### Example 31 | 32 | In this example, the misspelled cmdlet name is fuzzy matched to several suggestions from most likely 33 | to least likely. 34 | 35 | ```powershell 36 | Get-Commnd 37 | ``` 38 | 39 | ```Output 40 | Get-Commnd : The term 'Get-Commnd' is not recognized as the name of a cmdlet, function, script file, 41 | or operable program. Check the spelling of the name, or if a path was included, verify that the path 42 | is correct and try again. 43 | At line:1 char:1 44 | + Get-Commnd 45 | + ~~~~~~~~~~ 46 | + CategoryInfo : ObjectNotFound: (Get-Commnd:String) [], CommandNotFoundException 47 | + FullyQualifiedErrorId : CommandNotFoundException 48 | 49 | 50 | Suggestion [4,General]: The most similar commands are: Get-Command, Get-Content, Get-Job, Get-Module, 51 | Get-Event, Get-Host, Get-Member, Get-Item, Set-Content. 52 | ``` 53 | 54 | ### Implicit Remoting Batching 55 | 56 | When using [implicit remoting](https://devblogs.microsoft.com/scripting/remoting-the-implicit-way/) 57 | in a pipeline, PowerShell treats each command in the pipeline independently. Objects are repeatedly 58 | serialized and `de-serialized` between the client and remote system over the execution of the 59 | pipeline. 60 | 61 | With this feature, PowerShell analyzes the pipeline to determine if the command is safe to run and 62 | it exists on the target system. When true, PowerShell executes the entire pipeline remotely and only 63 | serializes and `de-serializes` the results back to the client. 64 | 65 | ```powershell 66 | Enable-ExperimentalFeature -Name PSImplicitRemotingBatching 67 | ``` 68 | 69 | A real-world test of `Get-Process | Sort-Object` over localhost decreases from 10-15 seconds to 70 | 20-30 **milliseconds**. The feature only needs to be enabled on the client. No changes are required 71 | on the server. 72 | 73 | ### Temp Drive 74 | 75 | ```powershell 76 | Enable-ExperimentalFeature -Name PSTempDrive 77 | ``` 78 | 79 | If you're using PowerShell Core on different operating systems, you'll discover that the environment 80 | variable for finding the temporary directory is different on Windows, macOS, and Linux! With this 81 | feature, you get a [PSDrive][] called `Temp:` that is automatically mapped to the temporary folder 82 | for the operating system you are using. 83 | 84 | #### Example 85 | 86 | ```powershell 87 | PS> "Hello World!" > Temp:/hello.txt 88 | PS> Get-Content Temp:/hello.txt 89 | Hello World! 90 | ``` 91 | 92 | Be aware that native file commands (like `ls` on Linux) are not aware of PSDrives and won't see this 93 | `Temp:` drive. 94 | 95 | ### Abbreviation Expansion 96 | 97 | PowerShell cmdlets are expected to have descriptive nouns. This results in long names that are more 98 | difficult to type. This feature allows you to just type the uppercase characters of the cmdlet and 99 | use tab-completion to find a match. 100 | 101 | ```powershell 102 | Enable-ExperimentalFeature -Name PSUseAbbreviationExpansion 103 | ``` 104 | 105 | #### Example 106 | 107 | ```powershell 108 | PS> i-arsavsf 109 | ``` 110 | 111 | If you hit tab, and have the Azure PowerShell [Az](https://www.powershellgallery.com/packages/Az) 112 | module installed, it will autocomplete to: 113 | 114 | ```Output 115 | PS> Import-AzRecoveryServicesAsrVaultSettingsFile 116 | ``` 117 | 118 | > [!NOTE] 119 | > This feature is intended to be used interactively. Abbreviated forms of cmdlets can't be executed. 120 | > This feature is not a replacement for aliases. 121 | 122 | ## Breaking Changes 123 | 124 | - Fix `-NoEnumerate` behavior in `Write-Output` to be consistent with Windows PowerShell. (#9069) 125 | - Make `Join-String -InputObject 1,2,3` result equal to `1,2,3 | Join-String` result (#8611) (Thanks 126 | @sethvs!) 127 | - Add `-Stable` to `Sort-Object` and related tests (#7862) (Thanks @KirkMunro!) 128 | - Improve `Start-Sleep` cmdlet to accept fractional seconds (#8537) (Thanks @Prototyyppi!) 129 | - Change hashtable to use OrdinalIgnoreCase to be `case-insensitive` in all Cultures (#8566) 130 | - Fix **LiteralPath** in `Import-Csv` to bind to `Get-ChildItem` output (#8277) (Thanks @iSazonov!) 131 | - No longer skips a column without name if double quote delimiter is used in `Import-Csv` (#7899) 132 | (Thanks @Topping!) 133 | - `Get-ExperimentalFeature` no longer has `-ListAvailable` switch (#8318) 134 | - Debug parameter now sets `$DebugPreference` to **Continue** instead of **Inquire** (#8195) (Thanks 135 | @KirkMunro!) 136 | - Honor `-OutputFormat` if specified in non-interactive, redirected, encoded command used with pwsh 137 | (#8115) 138 | - Load assembly from module base path before trying to load from the GAC (#8073) 139 | - Remove tilde from Linux preview packages (#8244) 140 | - Move processing of `-WorkingDirectory` before processing of profiles (#8079) 141 | - Do not add `PATHEXT` environment variable on Unix (#7697) (Thanks @iSazonov!) 142 | 143 | ## Known Issues 144 | 145 | - Remoting on Windows IOT ARM platforms has an issue loading modules. See (#8053) 146 | 147 | ## General Updates and Fixes 148 | 149 | - Enable case-insensitive tab completion for files and folders on case-sensitive filesystem (#8128) 150 | - Make PSVersionInfo.PSVersion and PSVersionInfo.PSEdition public (#8054) (Thanks @KirkMunro!) 151 | - Add Type Inference for `$_` / `$PSItem` in `catch{ }` blocks (#8020) (Thanks @vexx32!) 152 | - Fix static method invocation type inference (#8018) (Thanks @SeeminglyScience!) 153 | - Create inferred types for `Select-Object`, `Group-Object`, **PSObject** and **Hashtable** (#7231) 154 | (Thanks @powercode!) 155 | - Support calling method with `ByRef-like` type parameters (#7721) 156 | - Handle the case where the Windows PowerShell module path is already in the environment's 157 | PSModulePath (#7727) 158 | - Enable `SecureString` cmdlets for non-Windows by storing the plain text (#9199) 159 | - Improve error message on non-Windows when importing clixml with securestring (#7997) 160 | - Adding parameter ReplyTo to `Send-MailMessage` (#8727) (Thanks @replicaJunction!) 161 | - Add Obsolete message to `Send-MailMessage` (#9178) 162 | - Fix `Restart-Computer` to work on `localhost` when WinRM is not present (#9160) 163 | - Make `Start-Job` throw terminating error when PowerShell is being hosted (#9128) 164 | - Add C# style type accelerators and suffixes for ushort, uint, ulong, and short literals (#7813) 165 | (Thanks @vexx32!) 166 | - Added new suffixes for numeric literals - see [about_Numeric_Literals][] (#7901) (Thanks @vexx32!) 167 | - Correctly Report impact level when SupportsShouldProcess is not set to 'true' (#8209) (Thanks 168 | @vexx32!) 169 | - Fix Request Charset Issues in Web Cmdlets (#8742) (Thanks @markekraus!) 170 | - Fix Expect `100-continue` issue with Web Cmdlets (#8679) (Thanks @markekraus!) 171 | - Fix file blocking issue with web cmdlets (#7676) (Thanks @Claustn!) 172 | - Fix code page parsing issue in `Invoke-RestMethod` (#8694) (Thanks @markekraus!) 173 | - Refactor `ConvertTo-Json` to expose JsonObject.ConvertToJson as a public API (#8682) 174 | - Add configurable maximum depth in `ConvertFrom-Json` with -Depth (#8199) (Thanks @louistio!) 175 | - Add EscapeHandling parameter in `ConvertTo-Json` cmdlet (#7775) (Thanks @iSazonov!) 176 | - Add `-CustomPipeName` to pwsh and `Enter-PSHostProcess` (#8889) 177 | - Enable creating relative symbolic links on Windows with `New-Item` (#8783) 178 | - Allow Windows users in developer mode to create symlinks without elevation (#8534) 179 | - Enable `Write-Information` to accept `$null` (#8774) 180 | - Fix `Get-Help` for advanced functions with MAML help content (#8353) 181 | - Fix `Get-Help` PSTypeName issue with -Parameter when only one parameter is declared (#8754) 182 | (Thanks @pougetat!) 183 | - Token calculation fix for `Get-Help` executed on ScriptBlock for comment help. (#8238) (Thanks 184 | @hubuk!) 185 | - Change `Get-Help` cmdlet -Parameter parameter so it accepts string arrays (#8454) (Thanks 186 | @sethvs!) 187 | - Resolve PAGER if its path contains spaces (#8571) (Thanks @pougetat!) 188 | - Add prompt to the use of `less` in the function 'help' to instruct user how to quit (#7998) 189 | - Add support enum and char types in `Format-Hex` cmdlet (#8191) (Thanks @iSazonov!) 190 | - Remove ShouldProcess from `Format-Hex` (#8178) 191 | - Add new Offset and Count parameters to `Format-Hex` and refactor the cmdlet (#7877) (Thanks 192 | @iSazonov!) 193 | - Allow 'name' as an alias key for 'label' in `ConvertTo-Html`, allow the 'width' entry to be an 194 | integer (#8426) (Thanks @mklement0!) 195 | - Make scriptblock based calculated properties work again in `ConvertTo-Html` (#8427) (Thanks 196 | @mklement0!) 197 | - Add cmdlet `Join-String` for creating text from pipeline input (#7660) (Thanks @powercode!) 198 | - Fix `Join-String` cmdlet FormatString parameter logic (#8449) (Thanks @sethvs!) 199 | - Change `Clear-Host` back to using `$RAWUI` and clear to work over remoting (#8609) 200 | - Change `Clear-Host` to simply called `[console]::clear` and remove clear alias from Unix (#8603) 201 | - Fix LiteralPath in `Import-Csv` to bind to `Get-ChildItem` output (#8277) (Thanks @iSazonov!) 202 | - help function shouldn't use pager for AliasHelpInfo (#8552) 203 | - Add `-UseMinimalHeader` to `Start-Transcript` to minimize transcript header (#8402) (Thanks 204 | @lukexjeremy!) 205 | - Add `Enable-ExperimentalFeature` and `Disable-ExperimentalFeature` cmdlets (#8318) 206 | - Expose all cmdlets from **PSDiagnostics** if logman.exe is available (#8366) 207 | - Remove **Persist** parameter from `New-PSDrive` on `non-Windows` platform (#8291) (Thanks 208 | @lukexjeremy!) 209 | - Add support for `cd +` (#7206) (Thanks @bergmeister!) 210 | - Enable `Set-Location -LiteralPath` to work with folders named - and + (#8089) 211 | - `Test-Path` returns `$false` when given an empty or `$null` path value (#8080) (Thanks @vexx32!) 212 | - Allow dynamic parameter to be returned even if path does not match any provider (#7957) 213 | - Support `Get-PSHostProcessInfo` and `Enter-PSHostProcess` on Unix platforms (#8232) 214 | - Reduce allocations in `Get-Content` cmdlet (#8103) (Thanks @iSazonov!) 215 | - Enable `Add-Content` to share read access with other tools while writing content (#8091) 216 | - `Get/Add-Content` throws improved error when targeting a container (#7823) (Thanks @kvprasoon!) 217 | - Add `-Name`, `-NoUserOverrides` and `-ListAvailable` parameters to `Get-Culture` cmdlet (#7702) 218 | (Thanks @iSazonov!) 219 | - Add unified attribute for completion for **Encoding** parameter. (#7732) (Thanks @ThreeFive-O!) 220 | - Allow numeric Ids and name of registered code pages in **Encoding** parameters (#7636) (Thanks 221 | @iSazonov!) 222 | - Fix `Rename-Item -Path` with wildcard char (#7398) (Thanks @kwkam!) 223 | - When using `Start-Transcript` and file exists, empty file rather than deleting (#8131) (Thanks 224 | @paalbra!) 225 | - Make `Add-Type` open source files with **FileAccess.Read** and **FileShare.Read** explicitly 226 | (#7915) (Thanks @IISResetMe!) 227 | - Fix `Enter-PSSession -ContainerId` for the latest Windows (#7883) 228 | - Ensure **NestedModules** property gets populated by `Test-ModuleManifest` (#7859) 229 | - Add `%F` case to `Get-Date` -UFormat (#7630) (Thanks @britishben!) 230 | - Fix `Set-Service -Status Stopped` to stop services with dependencies (#5525) (Thanks @zhenggu!) 231 | 232 | 233 | 234 | [about_Numeric_Literals]: /powershell/module/Microsoft.PowerShell.Core/About/about_numeric_literals 235 | [Experimental Features]: /powershell/module/Microsoft.PowerShell.Core/About/about_Experimental_Features 236 | [PSDrive]: /powershell/module/microsoft.powershell.management/new-psdrive 237 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | --- 2 | ms.date: 06/27-2024 3 | --- 4 | # Get-WhatsNew 5 | 6 | [Get-WhatsNew][04] is a cmdlet that provides information about changes and new features for a 7 | version of PowerShell, delivered to the local terminal experience. 8 | 9 | ## Motivation 10 | 11 | Customers are unaware of benefits, new features and changes, that could impact their automation, 12 | performance and security. Today, this useful information is provided through [Microsoft Docs][01] 13 | and the PowerShell GitHub repository. PowerShell customers would benefit from being able to get this 14 | information in the terminal as they expect. 15 | 16 | - Customers expect to learn about available features that may enable new solutions 17 | - Customers expect version specific information available from within PowerShell to make upgrade 18 | decisions. 19 | 20 | > As an admin, 21 | > I can list the new features released in my current version of PowerShell, similar to [webview][02] 22 | > so that I can discover and implement new features in managing my products. 23 | 24 | > As a developer, 25 | > I can list the new features released in my current version of PowerShell, similar to [webview][02] 26 | > so that I can discover and implement new features to develop automation solutions. 27 | 28 | ## Code of Conduct 29 | 30 | Please see our [Code of Conduct](.github/CODE_OF_CONDUCT.md) before participating in this project. 31 | 32 | ## Security Policy 33 | 34 | For any security issues, please see our [Security Policy](.github/SECURITY.md). 35 | 36 | ## NOTE 37 | 38 | This is a prototype for the draft [RFC #317][03]. We welcome your feedback in this repository. 39 | 40 | 41 | [01]: https://docs.microsoft.com/powershell/scripting/whats-new/what-s-new-in-powershell-70 42 | [02]: https://docs.microsoft.com/powershell/scripting/whats-new/what-s-new-in-powershell-72 43 | [03]: https://github.com/PowerShell/PowerShell-RFC/pull/317 44 | [04]: https://github.com/PowerShell/WhatsNew 45 | -------------------------------------------------------------------------------- /build.ps1: -------------------------------------------------------------------------------- 1 | param ( [switch]$publish, [switch]$test, [switch]$package, [switch]$clean ) 2 | $moduleName = "Microsoft.PowerShell.WhatsNew" 3 | $psd = Import-PowerShellDataFile "$PSScriptRoot/${moduleName}/${moduleName}.psd1" 4 | $moduleVersion = $psd.ModuleVersion 5 | $moduleDeploymentDir = "${PSScriptRoot}/out/${moduleName}/${moduleVersion}" 6 | 7 | if ( $clean ) { 8 | $paths = "${PSScriptRoot}/out", "${PSScriptRoot}/testResults.xml" 9 | foreach ($path in $paths) { 10 | if (Test-Path $path) { 11 | $null = Remove-Item -Force -Recurse $path 12 | } 13 | } 14 | } 15 | 16 | if ($publish) { 17 | # create directory with version 18 | # copy files to that location 19 | if (-not (Test-Path $moduleDeploymentDir)) { 20 | New-Item -Type Directory -Force -Path $moduleDeploymentDir 21 | } 22 | Copy-Item -Force -Recurse "$PSScriptRoot/${moduleName}/*" $moduleDeploymentDir 23 | } 24 | 25 | if ( $test ) { 26 | if ( ! $publish ) { 27 | ./build.ps1 -publish 28 | } 29 | # run tests 30 | $psExe = (get-process -id $PID).MainModule.filename 31 | $testCommand = "import-module $PSScriptRoot/out/${moduleName}; Set-Location $PSScriptRoot/test; Invoke-Pester -OutputFormat NUnitXml -OutputFile $PSScriptRoot/testResults.xml" 32 | $psArgs = "-noprofile","-noninteractive","-command",$testCommand 33 | & $psExe $psArgs 34 | } 35 | 36 | if ( $package ) { 37 | if (-not (test-path $moduleDeploymentDir)) { 38 | throw "Could not find '$moduleDeploymentDir'" 39 | } 40 | $repoName = [Guid]::NewGuid().ToString("N") 41 | try { 42 | Register-PSRepository -Name $repoName -SourceLocation "${PSScriptRoot}/out" 43 | Publish-Module -Path $moduleDeploymentDir -Repository $repoName 44 | } 45 | finally { 46 | Unregister-PSRepository -Name $repoName 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /ci.yaml: -------------------------------------------------------------------------------- 1 | name: Build-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr) 2 | trigger: 3 | # Batch merge builds together while a merge build is running 4 | batch: true 5 | branches: 6 | include: 7 | - main 8 | - release/* 9 | pr: 10 | branches: 11 | include: 12 | - main 13 | - release/* 14 | 15 | resources: 16 | repositories: 17 | - repository: ComplianceRepo 18 | type: github 19 | endpoint: ComplianceGHRepo 20 | name: PowerShell/Compliance 21 | 22 | stages: 23 | - stage: Build 24 | jobs: 25 | - job: 'Full_Build' 26 | pool: 27 | vmImage: windows-latest 28 | steps: 29 | - pwsh: | 30 | ./build.ps1 -publish 31 | displayName: 'Full Build' 32 | - pwsh: | 33 | Write-Host "##vso[artifact.upload containerfolder=out;artifactname=out;]${env:Build_SourcesDirectory}/out" 34 | - stage: Test 35 | jobs: 36 | - job: 37 | strategy: 38 | matrix: 39 | Ubuntu_18_04: 40 | vmImage: ubuntu-18.04 41 | Ubuntu_20_04: 42 | vmImage: ubuntu-20.04 43 | mac_Latest: 44 | vmImage: macOS-latest 45 | Windows_Server2022_PowerShell_Core: 46 | vmImage: windows-2022 47 | pool: 48 | vmImage: $[ variables['vmImage'] ] 49 | steps: 50 | - template: templates/test-pwsh.yaml 51 | - job: 52 | strategy: 53 | matrix: 54 | Windows_Server2022_PowerShell_5_1: 55 | vmImage: windows-2022 56 | pwsh: false 57 | pool: 58 | vmImage: $[ variables['vmImage'] ] 59 | steps: 60 | - template: templates/test-powershell.yaml 61 | 62 | - stage: compliance 63 | displayName: Compliance 64 | dependsOn: Build 65 | jobs: 66 | - job: Compliance_Job 67 | pool: 68 | vmImage: windows-latest 69 | steps: 70 | - checkout: self 71 | - checkout: ComplianceRepo 72 | - template: ci-compliance.yml@ComplianceRepo 73 | -------------------------------------------------------------------------------- /releaseBuild.yml: -------------------------------------------------------------------------------- 1 | name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr) 2 | 3 | trigger: none 4 | 5 | resources: 6 | repositories: 7 | - repository: ComplianceRepo 8 | type: github 9 | endpoint: ComplianceGHRepo 10 | name: PowerShell/compliance 11 | 12 | variables: 13 | - name: PackageName 14 | value: 'Microsoft.PowerShell.WhatsNew' 15 | - name: PackageVersion 16 | value: '' 17 | 18 | stages: 19 | - stage: Build 20 | displayName: Build module 21 | pool: 22 | name: 1ES 23 | demands: 24 | - ImageOverride -equals PSMMS2019-Secure 25 | jobs: 26 | - job: BuildPkg 27 | displayName: Build module 28 | variables: 29 | - group: ESRP 30 | steps: 31 | 32 | - pwsh: | 33 | New-Item -ItemType Directory -Path $(Build.SourcesDirectory)\out | out-null 34 | $outputfolder = & $(Build.SourcesDirectory)\Build.ps1 -clean -publish 35 | Write-Host "##vso[task.setvariable variable=OutputFolder]$outputFolder" 36 | 37 | displayName: Build Microsoft.PowerShell.WhatsNew module 38 | condition: succeededOrFailed() 39 | - pwsh: | 40 | Get-childitem "$(Build.SourcesDirectory)\out\Microsoft.PowerShell.WhatsNew\*" -Recurse 41 | displayName: Show BuildOutDirectory 42 | - template: Sbom.yml@ComplianceRepo 43 | parameters: 44 | BuildDropPath: $(outputfolder) 45 | Build_Repository_Uri: 'https://github.com/PowerShell/WhatsNew' 46 | PackageName: $(PackageName) 47 | PackageVersion: $(PackageVersion) 48 | 49 | - pwsh: | 50 | Get-Childitem "$(outputfolder)" -Recurse 51 | displayName: Show BuildOutDirectory 52 | - pwsh: | 53 | $signSrcPath = "$(Build.SourcesDirectory)\out\Microsoft.PowerShell.WhatsNew\" 54 | # Set signing src path variable 55 | $vstsCommandString = "vso[task.setvariable variable=signSrcPath]${signSrcPath}" 56 | Write-Host "sending " + $vstsCommandString 57 | Write-Host "##$vstsCommandString" 58 | $signOutPath = "$(Build.SourcesDirectory)\signed\Microsoft.PowerShell.WhatsNew" 59 | $null = New-Item -ItemType Directory -Path $signOutPath 60 | # Set signing out path variable 61 | $vstsCommandString = "vso[task.setvariable variable=signOutPath]${signOutPath}" 62 | Write-Host "sending " + $vstsCommandString 63 | Write-Host "##$vstsCommandString" 64 | # Set path variable for guardian codesign validation 65 | $vstsCommandString = "vso[task.setvariable variable=GDN_CODESIGN_TARGETDIRECTORY]${signOutPath}" 66 | Write-Host "sending " + $vstsCommandString 67 | Write-Host "##$vstsCommandString" 68 | displayName: Setup variables for signing 69 | - template: EsrpSign.yml@ComplianceRepo 70 | parameters: 71 | # the folder which contains the binaries to sign 72 | buildOutputPath: $(signSrcPath) 73 | # the location to put the signed output 74 | signOutputPath: $(signOutPath) 75 | # the certificate ID to use 76 | certificateId: "CP-230012" 77 | # the file pattern to use, comma separated 78 | pattern: '*.psd1,*.psm1' 79 | 80 | - pwsh: | 81 | Compress-Archive -Path "$(signOutPath)\*" -DestinationPath "$(System.ArtifactsDirectory)\Microsoft.PowerShell.WhatsNew.zip" 82 | displayName: Create Microsoft.PowerShell.WhatsNew.zip 83 | - publish: $(System.ArtifactsDirectory)\Microsoft.PowerShell.WhatsNew.zip 84 | artifact: SignedModule 85 | 86 | - template: script-module-compliance.yml@ComplianceRepo 87 | parameters: 88 | # component-governance 89 | sourceScanPath: '$(signOutPath)' 90 | # credscan 91 | suppressionsFile: '' 92 | # TermCheck 93 | optionsRulesDBPath: '' 94 | optionsFTPath: '' 95 | # tsa-upload 96 | codeBaseName: 'Microsoft_PowerShell_WhatsNew_7_29_2022' 97 | # selections 98 | APIScan: false # set to false when not using Windows APIs. 99 | - stage: Publish 100 | displayName: Publish module 101 | condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release')) 102 | variables: 103 | - group: PSGalleryKey 104 | pool: 105 | name: 1ES 106 | demands: 107 | - ImageOverride -equals PSMMS2019-Secure 108 | jobs: 109 | 110 | - deployment: PublishPkg 111 | displayName: Publish module to PSGallery 112 | environment: WhatsNewPublishApproval 113 | strategy: 114 | runOnce: 115 | deploy: 116 | steps: 117 | - download: current 118 | artifact: signedmodule 119 | - powershell: | 120 | $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 121 | Expand-Archive -Path "$(pipeline.workspace)/signedmodule/*.zip" -destinationPath "$(Build.ArtifactStagingDirectory)/Publish/Microsoft.PowerShell.WhatsNew" -Verbose 122 | $env:PSModulePath = "$(Build.ArtifactStagingDirectory)/Publish/Microsoft.PowerShell.WhatsNew;$env:PSModulePath" 123 | Publish-Module -Name Microsoft.PowerShell.WhatsNew -NugetAPIKey $(psgalleryAPIkey) -Verbose 124 | -------------------------------------------------------------------------------- /spec/Get-WhatsNew.specification.md: -------------------------------------------------------------------------------- 1 | --- 2 | RFC: RFC00XX 3 | Author: Jason Helmick 4 | Status: Draft 5 | SupercededBy: N/A 6 | Version: 1.0 7 | Area: Core 8 | Comments Due: 4/30/2022 9 | Plan to implement: Yes 10 | --- 11 | # Get-WhatsNew 12 | 13 | [Get-WhatsNew](https://github.com/PowerShell/WhatsNew) is a cmdlet that provides information about 14 | changes and new features for a version of PowerShell, delivered to the local terminal experience. 15 | 16 | ## Motivation 17 | 18 | Customers are unaware of benefits, new features and changes, that could impact their automation, 19 | performance and security. Today, this useful information is provided through 20 | [Microsoft Docs](https://docs.microsoft.com/powershell/scripting/whats-new/what-s-new-in-powershell-70) 21 | and the PowerShell GitHub repository. PowerShell customers would benefit from being able to get this 22 | information in the terminal as they expect. 23 | 24 | - Customers expect to learn about available features that may enable new solutions 25 | - Customers expect version specific information available from within PowerShell to make upgrade 26 | decisions. 27 | 28 | > As an admin, 29 | > I can list the new features released in my current version of PowerShell, similar 30 | > to [webview](https://docs.microsoft.com/powershell/scripting/whats-new/what-s-new-in-powershell-72) 31 | > so that I can discover and implement new features in managing my products. 32 | 33 | > As a developer, 34 | > I can list the new features released in my current version of PowerShell, similar 35 | > to [webview](https://docs.microsoft.com/powershell/scripting/whats-new/what-s-new-in-powershell-72) 36 | > so that I can discover and implement new features to develop automation solutions. 37 | 38 | ## Goals/Non-Goals 39 | 40 | The WhatsNew module is not intended to be included with PowerShell. This will be published as a 41 | separate module on the Gallery supporting PowerShell 7 and down-level to Windows PowerShell 5.1. 42 | 43 | Goals 44 | 45 | - Be distributed as a PowerShell module on the Gallery 46 | - Support disconnected scenarios (data ships with module) 47 | - Supports Windows PowerShell 5.1 48 | - Supports a message-of-the-day (motd) option 49 | - Provides easy access to the web version of the release notes 50 | - Output is text-only 51 | 52 | Non-goals/Alternatives 53 | 54 | - Provide data model for filtering and pipelining of the output 55 | - Ability to compare versions 56 | - Data endpoint (Microservice) to synchronously deliver or update the data. 57 | - Changelog information 58 | 59 | Future feature considerations 60 | 61 | - Render markdown output in the console with ANSI styling (enabled by switch parameter) 62 | - Convert GitHub issue and PR IDs to hyperlinks 63 | - Convert markdown hyperlinks to fully-qualified URLs 64 | - Use ANSI strings to make hyperlinks clickable for terminals that support it 65 | - Expand cmdlet to support What's New information from other data sources (eg. Az PowerShell, etc.) 66 | - Add `Get-Changelog` cmdlet to display Changelog information 67 | 68 | ## Solution 69 | 70 | Ship a **Microsoft.PowerShell.WhatsNew** module on the PowerShell Gallery that contains the cmdlet 71 | and would: 72 | 73 | - Be discoverable using normal PowerShell conventions 74 | - Be available down-level to Windows PowerShell 5.1 75 | 76 | ## Specification 77 | 78 | This specification is based on the cmdlet [Get-WhatsNew](https://github.com/PowerShell/WhatsNew) 79 | 80 | - Module Name: Microsoft.PowerShell.WhatsNew 81 | - Cmdlet name: Get-WhatsNew 82 | - Alias: none 83 | 84 | ### Syntax and parameter sets 85 | 86 | - ByVersion (Default) 87 | 88 | ``` 89 | Get-WhatsNew [[-Version] ] [] 90 | ``` 91 | 92 | - ByVersionOnline 93 | 94 | ``` 95 | Get-WhatsNew [[-Version] ] -Online [] 96 | ``` 97 | 98 | - ByVersionDaily 99 | 100 | ``` 101 | Get-WhatsNew [[-Version] ] -Daily [] 102 | ``` 103 | 104 | - AllVersions 105 | 106 | ``` 107 | Get-WhatsNew -All [] 108 | ``` 109 | 110 | The **Version** parameter has validation for all of the versions of the release notes included in 111 | the module. The version list is built dynamically and validated using `[ValidateScript()]`. There is 112 | also an argument completer for the parameter. 113 | 114 | ### Data model 115 | 116 | To minimize content maintenance and allow for disconnected scenarios, the data presented is stored 117 | with the module as version-specific markdown files. 118 | 119 | - Uses the same markdown files as the 120 | [webview](https://docs.microsoft.com/powershell/scripting/whats-new/what-s-new-in-powershell-72) 121 | - Version files are updated in the module at the time of a new release or a major change to the 122 | release notes 123 | - This allows for disconnected scenarios 124 | - Minimizes the maintenance of the content 125 | - Update support 126 | - Updates to the data require publishing a new version of the module to the Gallery 127 | - To get the latest data, the user runs `Update-Module` 128 | - Eliminates the need for a Microservice to serve the data or updates 129 | 130 | ### Output 131 | 132 | Output from the cmdlet is in the form of markdown strings that are displayed to the terminal. 133 | 134 | ### Demo.txt - Features 135 | 136 | Example 1: Displays the release notes for the version of PowerShell in which the cmdlet is running. 137 | 138 | ```powershell 139 | PS> Get-WhatsNew 140 | ``` 141 | 142 | Example 2: Displays the release notes for PowerShell 5.1 regardless of which version the cmdlet is 143 | running. 144 | 145 | ```powershell 146 | PS> Get-WhatsNew -Version '5.1' 147 | ``` 148 | 149 | Example 3: Displays one randomly selected section of the release notes per version of PowerShell 150 | selected. 151 | 152 | ```powershell 153 | PS> Get-WhatsNew -Daily -Version '7.0', '7.1', '7.2' 154 | ``` 155 | 156 | Example 4: Displays all of the releases for all versions supported by the cmdlet. 157 | 158 | ```powershell 159 | PS> Get-WhatsNew -All 160 | ``` 161 | 162 | Example 5: Opens your web browser and takes you to the webpage for the specified version of the 163 | release notes. If no version is specified, it uses the current version. 164 | 165 | ```powershell 166 | PS> Get-WhatsNew -Online -Version '7.3', '7.2' 167 | ``` 168 | 169 | If you specify multiple versions with `-Online`, the cmdlet displays a warning but opens the webpage 170 | for the first version listed. 171 | 172 | Example 6: Displays the release notes for PowerShell 7.0 through PowerShell 7.2. 173 | 174 | ```powershell 175 | PS> Get-WhatsNew -Version '7.0', '7.1', '7.2' 176 | ``` 177 | -------------------------------------------------------------------------------- /spec/questions.md: -------------------------------------------------------------------------------- 1 | # Implementation questions 2 | 3 | ## Functionality of -Daily 4 | 5 | - Q: Should -Daily allow you to provide a list of versions? 6 | - Q: If -Daily does not allow a list of versions, what versions should be used? 7 | - Should 5.1 be included? 8 | - Should we filter out 5.1 from non-Windows systems? 9 | - Q: Should the parameter name be -MOTD rather than an alias? 10 | 11 | ## Functionality of -All 12 | 13 | - Q: Should we filter out 5.1 from non-Windows systems? 14 | 15 | -------------------------------------------------------------------------------- /templates/test-powershell.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - task: DownloadPipelineArtifact@2 3 | displayName: 'Download Pipeline Artifact: out Folder' 4 | inputs: 5 | artifactName: out 6 | targetPath: '$(Build.SourcesDirectory)/out' 7 | - powershell: | 8 | Install-Module Pester -Force -Verbose 9 | ./build.ps1 -publish -test 10 | displayName: 'Test' 11 | 12 | - task: PublishTestResults@2 13 | inputs: 14 | testRunner: NUnit 15 | testResultsFiles: 'testResults.xml' 16 | condition: succeededOrFailed() 17 | -------------------------------------------------------------------------------- /templates/test-pwsh.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - task: DownloadPipelineArtifact@2 3 | displayName: 'Download Pipeline Artifact: out Folder' 4 | inputs: 5 | artifactName: out 6 | targetPath: '$(Build.SourcesDirectory)/out' 7 | - pwsh: | 8 | Install-Module Pester -Force -Verbose 9 | ./build.ps1 -publish -test 10 | displayName: 'Test' 11 | 12 | - task: PublishTestResults@2 13 | inputs: 14 | testRunner: NUnit 15 | testResultsFiles: 'testResults.xml' 16 | condition: succeededOrFailed() 17 | -------------------------------------------------------------------------------- /test/WhatsNew.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "General tests for 'Get-WhatsNew'" { 2 | BeforeAll { 3 | $files = "What-s-New-in-PowerShell-70.md", 4 | "What-s-New-in-PowerShell-71.md", 5 | "What-s-New-in-PowerShell-72.md", 6 | "What-s-New-in-PowerShell-73.md", 7 | "What-s-New-in-PowerShell-74.md", 8 | "What-s-New-in-PowerShell-75.md", 9 | "What-s-New-in-PowerShell-Core-60.md", 10 | "What-s-New-in-PowerShell-Core-61.md", 11 | "What-s-New-in-PowerShell-Core-62.md", 12 | "What-s-New-in-Windows-PowerShell-50.md" 13 | $header2hash = @{} 14 | foreach ( $file in $files ) { 15 | $fileNumber = $file -replace ".*(\d\d).md",'$1' 16 | $key = "File${fileNumber}" 17 | $header2hash[$key] = (select-string "^## " "../Microsoft.PowerShell.WhatsNew/relnotes/$file").line 18 | } 19 | } 20 | It "Handles Single Version" { 21 | $observed = (Get-WhatsNew -version 7.4 | Select-String "^## ").Line 22 | $observed | Should -Be $header2hash["File74"] 23 | } 24 | 25 | It "Handles Single Version ending in '0'" { 26 | $observed = (Get-WhatsNew -version 7.0 | Select-String "^## ").line 27 | $observed | Should -Be $header2hash["File70"] 28 | } 29 | 30 | It "Handles multiple versions" { 31 | $observed = (Get-WhatsNew -version 7.0,6.0,5.1 | Select-String "^## ").line 32 | $collection = @( $header2hash["File70"]; $header2hash["File60"]; $header2hash["File50"]) 33 | $observed | Should -Be $collection 34 | } 35 | 36 | It "Converts a version missing the period to version.0" { 37 | $observed = (Get-WhatsNew -version 7 | Select-String "^## ").line 38 | $observed | Should -Be $header2hash["File70"] 39 | } 40 | 41 | It "Returns all versions" { 42 | $observed = Get-WhatsNew -All | select-string '^# Release notes for' 43 | $observed.Count | Should -Be $files.Count 44 | } 45 | } 46 | 47 | --------------------------------------------------------------------------------