PowerShell 7.7.0 came out on November 10, the same day 7.4 and 7.5 reached end of support and 7.6.10 shipped alongside it. A week later I added 7.7 to the version rules in ai-powershell-standards, the PowerShell rules I keep for GitHub Copilot, Claude Code and Codex.

I’m always excited about a new release, and I knew I’d be asked about this one. I played around with it for a week before deciding to add it to the standards.

The obvious question for a set of rules that agents follow is which version to write for. The answer in the rules is still 7.6, and 7.7 is opt-in. Anyone who installs 7.7 will run code written for 7.6 on it, though, so the rules list what 7.7 changes, and every one of those statements was run on 7.7.0 before it went in. This post is about how that split works and why I landed on it.

Two versions, one end date

The support picture right now:

VersionTypeReleasedEnd of supportRuntime
7.7Stable10-Nov-202614-Nov-2028.NET 11
7.6LTS18-Mar-202614-Nov-2028.NET 10
7.5Stable23-Jan-202510-Nov-2026.NET 9
7.4LTS16-Nov-202310-Nov-2026.NET 8

PowerShell’s lifecycle follows the .NET version it’s built on. Microsoft’s lifecycle page lists 7.6 through 14-Nov-2028. When I checked on 2026-11-17 it didn’t list 7.7 yet, so the rules give 7.7 the end date that the .NET release index gives for .NET 11. That’s the same day.

Picking 7.6 over 7.7 doesn’t buy you more support time. Both versions get security fixes until November 2028, then both are done. Whatever your reason to stay on 7.6, longevity isn’t it.

Why 7.6 stays the default

VER-01 is the rule an agent reads:

1
2
3
- **VER-01** Write for PowerShell 7.6 (LTS) unless the project declares another target. The
  declaration is the project's `#requires -Version` lines and the `PowerShellVersion` and
  `CompatiblePSEditions` keys of its module manifest.

The reasons for keeping it come from where the code runs.

GitHub’s hosted runners carry 7.6. The runner images moved from 7.4 to 7.6, and they don’t carry 7.7. Every CI job you get from the standards runs on whatever pwsh the runner has, and if your module requires 7.7 it fails there before a single test runs.

Windows fleets get it through an installer, and the installer changed. Starting with 7.7, Microsoft ships PowerShell as MSIX alone. Their announcement says MSIX doesn’t cover some scenarios MSI did, naming remoting and execution by system-level services like Task Scheduler. 7.6 keeps its MSI for its lifecycle. If you deploy PowerShell to servers and run scripts from scheduled tasks, that’s a real reason to sit on 7.6 for a while.

I haven’t run into anything in my current environments that needs the MSI, or a change approval that cared about LTS vs Stable. I’m sure I’ll hit a use case eventually where I’ll kick and scream and 7.6 will be the choice.

None of that stops you from choosing 7.7. The target table gives it a row:

SituationTargetManifest keys
New automation, CI, containers7.6PowerShellVersion = '7.6', CompatiblePSEditions = @('Core')
Module for machines that may not have PowerShell 75.1PowerShellVersion = '5.1', CompatiblePSEditions = @('Desktop', 'Core')
Code that needs a feature added in 7.77.7PowerShellVersion = '7.7', CompatiblePSEditions = @('Core')

The rules spell out what opt-in means: an agent uses a 7.7 feature only when the project declares 7.7, with #requires -Version 7.7 or PowerShellVersion = '7.7'. Without that declaration the target is 7.6, and VER-04 forbids anything the declared target doesn’t have.

When your project declares nothing and the right row isn’t clear, the agent asks you. If it can’t ask, it writes for 7.6 and says it assumed the target.

One more line came out of the release. #requires -Version 7.0 used to be the way to say “any PowerShell 7”. 7.0 is long retired, so the rules say to name the lowest supported version, which has been 7.6 since November 10.

What 7.7 adds, and what to use on 7.6

An agent that knows a 7.7 feature needs to know what to write instead on 7.6. The rules pair each one:

FeatureUse on 7.6
New-TemporaryDirectory[System.IO.Directory]::CreateTempSubdirectory()
Join-Path -Extension[System.IO.Path]::ChangeExtension() on the joined path
-ExcludeProperty on the Format-* cmdletsSelect-Object -Property * -ExcludeProperty <names> first
[WildcardPattern]::ToRegex()The pattern’s own IsMatch() method
$PSApplicationOutputEncodingSet [Console]::OutputEncoding, and restore it in finally

With an empty extension, ChangeExtension() leaves the dot (file.), while 7.7’s -Extension '' removes the dot too. That one showed up only when the statement was run on 7.7.0. The release notes didn’t say.

An agent would keep getting $PSApplicationOutputEncoding wrong without being told. Assigning $PSApplicationOutputEncoding on 7.6 raises no error and changes nothing. It just creates an ordinary variable, and native output is still read with [Console]::OutputEncoding. Code that sets it looks fine, passes tests that don’t check encoding, and does nothing on the version the project targets.

A comparison of every command and parameter that 7.6.10 and 7.7.0 ship found nothing else added outside PSResourceGet, and nothing removed. 7.7 also promotes no experimental feature. PSLoadAssemblyFromNativeCode, PSSerializeJSONLongEnumAsNumber and PSProfileDSCResource are still experimental, so an agent shouldn’t tell anyone to rely on them.

Code written for 7.6, run on 7.7

This applies to every project, 7.7 target or not. Code written for 7.6 is also run on 7.7 by anyone who has installed it, so the rule says to check it against the behavior that 7.7 changed. Each of these was measured on 7.7.0, with the older behavior on 7.6.10 and 5.1.

New-Guid returns a version 7 UUID. Earlier versions return a random version 4 UUID. Version 7 begins with the time it was created. The output format is the same. A GUID identifies something and was never a secret, but from 7.7 part of one can be worked out from the clock. Where you need a specific kind, call [guid]::NewGuid() for version 4, or [guid]::CreateVersion7() for version 7, which 5.1 doesn’t have.

-NoTypeInformation is obsolete on Export-Csv and ConvertTo-Csv. It has no effect on 7, and on 7.7 it writes a warning every time it’s passed. Windows PowerShell 5.1 still writes a #TYPE line without it. Export-Csv -NoTypeInformation has been habit since 5.1, so the warning will turn up in plenty of older scripts. The rules give a form that’s clean on all three versions:

1
2
3
4
5
6
7
8
9
$exportParameters = @{
    LiteralPath = $csvPath
    Encoding = 'utf8'
}
if ($PSVersionTable.PSVersion -lt [version]'6.0') {
    # Windows PowerShell 5.1 writes a #TYPE line unless this switch is passed.
    $exportParameters['NoTypeInformation'] = $true
}
$rows | Export-Csv @exportParameters

Run on 7.7.0, 7.6.10 and 5.1: no warning, and the file starts with the header line on all three.

Export-Csv -Append -NoHeader is a terminating error on 7.7. On 7.6 the pair is accepted and writes rows without a header. If you append to a nightly CSV that way, your script works on 7.6 and stops on 7.7.

Format-Table, Format-List and Format-Custom reject -Property $null and an empty array on 7.7. Earlier versions accept $null and show every property. Add -Property to your splat only when it has a value.

Get-ChildItem -Path '*.md' -Recurse -Name also returns matches in subfolders on 7.7. On 7.6 and 5.1 it returns only the ones in the starting folder. -Filter '*.md' recurses on every version, and STY-43 already asks for it.

Resolve-Path -Relative writes .\.config\app.json on 7.7 for a name that starts with a dot. On 7.6 and 5.1 it writes .config\app.json.

Get-Help indents the .NOTES text differently. One blank line and four spaces on 7.7, two blank lines and eight spaces on 7.6 and 5.1. If you have a test that compares help text exactly, it gets a different result.

7.6 keeps changing too

Servicing releases change what correct 7.6 code looks like too. These are in the same table as the 7.7 rows:

VersionChange
7.6.10New-FileCatalog -CatalogVersion 1, and Test-FileCatalog on a version 1 catalog, write a warning, because version 1 uses SHA-1.
7.6.7Test-Json fetches a schema that another schema refers to by URL only when -FetchExternalReference is passed. Without it the reference is an error, and the result is $false for valid input as well.
7.6.5Invoke-RestMethod and Invoke-WebRequest send the Authorization header with the first request only. A link followed by -FollowRelLink is requested without it.

The 7.6.5 change got a rule of its own. If you page through an authenticated API with -FollowRelLink, your function gets page one with the credential and every page after it without. The service answers with a refusal, or with the smaller answer an anonymous caller gets. -PreserveAuthorizationOnRedirect isn’t the fix, because it sends the credential to whatever host a link or a redirect names.

SEC-09 says to follow the links in the function, send the credential only to the scheme, host and port of the first request, and pass -MaximumRedirection 0. The function that does it, Get-PagedResponse.ps1, is a real file in the repo with 23 Pester tests, run on 7.7.0, 7.6.10 and 5.1. Each defect in its first version was reproduced against a local server: it followed a redirect without the header, it looped forever on a next link back to a page it had already requested, and it returned single bytes for a JSON body with a content type like application/vnd.api+json.

How a claim about 7.7 gets in

The first version of the 7.7 rules didn’t come from running 7.7. It came from the release notes and the source, and the rules said so wherever they stated something about 7.7. The pull request description was blunt about it: “Nothing here was run on PowerShell 7.7.”

It said what it didn’t know, and that wasn’t good enough to leave in place. The next commit in the same pull request ran every statement on 7.7.0. All of them held, and the sentences that said “not run” were replaced by what was measured. The run also turned up the Join-Path -Extension '' behavior and the command-and-parameter comparison. The packing behavior behind the Gallery release rules was measured again with PSResourceGet 1.3.1 and hadn’t changed. The quality gate passes under 7.7.0 with PSScriptAnalyzer 1.25.0 and Pester 6.2.0.

Then the contributing rules caught up. They used to say to test a claim about PowerShell behavior on 7.6 and 5.1 before writing it down. Now the README says:

When a rule states how PowerShell or Pester behaves, test the statement on PowerShell 7.6 and Windows PowerShell 5.1 before writing it down, and on PowerShell 7.7 as well when the statement is about 7.7.

That has to be a written rule because CI can’t enforce it. The quality gate runs on GitHub’s Windows, Linux and macOS runners, and none of them have 7.7. A claim about 7.7 gets run by hand, on a machine with 7.7 installed, and the commit message says where and on what. The logging skill’s PSFramework measurements were run on 7.7.0, 7.6.10 and 5.1 the same way.

Although I have 7.7 installed on my desktop, for this repo specifically I use a set of VMs on my Proxmox host to run the tests locally.

Where that leaves an agent

Put together, an agent working in a project that uses the standards does this:

  • Writes for 7.6, unless the project declares 7.7 or 5.1.
  • Uses a 7.7 feature only after seeing that declaration, and otherwise reaches for the 7.6 replacement in the table.
  • Checks 7.6 code against the 7.7 behavior changes, because that code will run on 7.7 somewhere.
  • Says when it assumed a target.
  • Recommends moving off a version past its end-of-support date, without changing the project’s declared target on its own.

Until something changes on the runners or in the lifecycle, 7.6 is what I write for, and 7.7 is what I test against.

To move the default, I’d need the CI runners to carry 7.7. It’s still new, so that won’t happen soon.

Sources