GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Change New-Guid to generate UUID v7 by default by SufficientDaikon · Pull Request #27033 · PowerShell/PowerShell

Conversation

@SufficientDaikon

@SufficientDaikon Ahmed Taha (SufficientDaikon) commented Mar 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

PR Summary

Changes New-Guid to generate UUID v7 (RFC 9562) by default using Guid.CreateVersion7(). UUID v7 embeds a millisecond-precision timestamp, making GUIDs monotonically sortable ΓÇö ideal for database primary keys and distributed systems.

Pester breaking WG

Warning

Breaking change: The default GUID version changes from v4 (fully random) to v7 (timestamp + random). The string format is identical (xxxxxxxx-xxxx-Vxxx-xxxx-xxxxxxxxxxxx), only the version nibble and content differ. Scripts that specifically depend on v4 randomness characteristics should use [Guid]::NewGuid().

The Cmdlets Working Group approved this change without experimental gating.

Users who need UUID v4 can call [Guid]::NewGuid() directly.

Fixes #24895.

What Changed

File Change
NewGuidCommand.cs Guid.NewGuid() → Guid.CreateVersion7()
New-Guid.Tests.ps1 Added version-nibble test: position 14 == 7

Before / After

- guid = Empty.ToBool() ? Guid.Empty : Guid.NewGuid();
+ guid = Empty.ToBool() ? Guid.Empty : Guid.CreateVersion7();

Tests

Pester

  • 9/9 Pester tests pass (8 existing + 1 new UUID v7 nibble test)
  • Smoke test: (New-Guid).ToString()[14] returns 7

PR Context

The Cmdlets Working Group approved this change in #24895 ΓÇö specifically @SteveL-MSFT's decision to change the default with no new switches. Guid.CreateVersion7() has been available since .NET 9; PowerShell targets .NET 11.

A previous attempt (#26256) was opened by Copilot but went stale.


PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge. If this PR is a work in progress, please open this as a Draft Pull Request and mark it as Ready to Review when it is ready to merge.
  • Breaking changes
    • None
    • Yes — The default GUID version changes from v4 to v7. The Cmdlets Working Group approved this change without requiring experimental feature gating.
  • User-facing changes
    • Documentation needed
      • Issue filed: MicrosoftDocs/PowerShell-Docs#12884
  • Testing - New and feature
    • Make sure you've added a new test if existing tests do not effectively test the code changed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SufficientDaikon Ahmed Taha (SufficientDaikon) mentioned this pull request Mar 15, 2026
Add UUID v7 support to New-Guid #24895
Closed
@SufficientDaikon
Ahmed Taha (SufficientDaikon) requested a review from a team as a code owner March 22, 2026 00:11
@SufficientDaikon Ahmed Taha (SufficientDaikon) mentioned this pull request Mar 24, 2026
Document New-Guid default change from UUID v4 to UUID v7 MicrosoftDocs/PowerShell-Docs#12884
Closed
@SufficientDaikon @claude
Change New-Guid to generate UUID v7 by default
bb0794b
Replace `Guid.NewGuid()` with `Guid.CreateVersion7()` in the
New-Guid cmdlet. UUID v7 (RFC 9562) embeds a millisecond-precision
timestamp making generated GUIDs monotonically sortable, which is
ideal for database primary keys and distributed systems.

Users who specifically need UUID v4 can call [Guid]::NewGuid() directly.

Fixes PowerShell#24895

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@SufficientDaikon
Ahmed Taha (SufficientDaikon) force-pushed the fix/new-guid-uuid-v7 branch from 015e5c4 to bb0794b Compare March 24, 2026 15:40
This was referenced Mar 24, 2026
Add bounded-wait timeout support to hosting API #27027
Open
Fix Get-Culture -ListAvailable:$false and Get-Location -Stack:$false #27034
Open
Fix 6 PVS-Studio static analyzer findings #27035
Open
Fix get-changed-files action for schedule and workflow_dispatch events #27078
Open
Ahmed Taha (SufficientDaikon) added a commit to SufficientDaikon/PowerShell-Docs that referenced this pull request Mar 25, 2026
@SufficientDaikon
Document New-Guid UUID v7 default change
6421b44
Update `New-Guid` reference page for PowerShell 7.6 to reflect the
change from UUID v4 to UUID v7 (`Guid.CreateVersion7()`). Add .NET API
examples per docs team request, and note the breaking change in the
What's New page.

Closes MicrosoftDocs#12884
Related: PowerShell/PowerShell#27033
@SufficientDaikon Ahmed Taha (SufficientDaikon) mentioned this pull request Mar 25, 2026
Document New-Guid UUID v7 default change MicrosoftDocs/PowerShell-Docs#12888
Merged
5 tasks done
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Review - Needed The PR is being reviewed label Apr 6, 2026
@doctordns

Thomas Lee (doctordns) commented Apr 6, 2026

Copy link
Copy Markdown
Collaborator

What is holding this up?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SufficientDaikon

Ahmed Taha (SufficientDaikon) commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

What is holding this up?

Thomas Lee (@doctordns) idk, do i need to do anything on my end? is there some sort of the check the code isn't passing?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kilasuit Ryan Yates (kilasuit) added CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Review - Maintainer The PR/issue needs a review from the PowerShell repo Maintainers labels Apr 7, 2026
@SufficientDaikon
Merge branch 'master' into fix/new-guid-uuid-v7
8e20b1f
Copilot AI review requested due to automatic review settings May 10, 2026 23:31
Copilot started reviewing on behalf of Ahmed Taha (SufficientDaikon) May 10, 2026 23:31
View session
Copilot AI reviewed May 10, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the New-Guid cmdlet to generate RFC 9562 UUID v7 values by default (time-ordered GUIDs via Guid.CreateVersion7()), aligning the cmdlet’s default behavior with newer UUID guidance while preserving the existing cmdlet surface area.

Changes:

  • Switched New-Guid default generation from Guid.NewGuid() (v4) to Guid.CreateVersion7() (v7) when not using -Empty or -InputObject.
  • Added a Pester assertion to validate the UUID version nibble is 7 in the default string representation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Microsoft.PowerShell.Commands.Utility/commands/utility/NewGuidCommand.cs Changes the cmdlet’s default GUID creation to UUID v7 via Guid.CreateVersion7().
test/powershell/Modules/Microsoft.PowerShell.Utility/New-Guid.Tests.ps1 Adds a test to confirm New-Guid produces UUID v7 by checking the version nibble in the string form.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SufficientDaikon

Ahmed Taha (SufficientDaikon) commented May 10, 2026

Copy link
Copy Markdown
Contributor Author

why does copilot keep triggering without being told to? You guys are wasting so much compute with this xD is this why new copilot subs are closed? all the copilot compute is going towards random pull requests xD

anyway, anything needed on my end?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SufficientDaikon
Merge branch 'master' into fix/new-guid-uuid-v7
7a11540
@kilasuit

Ryan Yates (kilasuit) commented May 16, 2026

Copy link
Copy Markdown
Collaborator

Steve Lee (@SteveL-MSFT) can we get this progressed please

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Ahmed Taha (SufficientDaikon) and others added 2 commits May 17, 2026 03:12
@SufficientDaikon
Merge branch 'master' into fix/new-guid-uuid-v7
cad67ca
@jshigetomi
Merge branch 'master' into fix/new-guid-uuid-v7
cd39819
jshigetomi
Justin Chung (jshigetomi) approved these changes Jun 26, 2026
View reviewed changes
@jshigetomi
Justin Chung (jshigetomi) merged commit 6f7ffc2 into PowerShell:master Jun 26, 2026
36 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@SufficientDaikon @claude @jshigetomi
Change New-Guid to generate UUID v7 by default (PowerShell#27033)
b93d957
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Justin Chung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@jshigetomi Justin Chung (jshigetomi) jshigetomi approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Review - Maintainer The PR/issue needs a review from the PowerShell repo Maintainers Review - Needed The PR is being reviewed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add UUID v7 support to New-Guid

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@SufficientDaikon @doctordns @kilasuit @jshigetomi
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.