Skip to content

Document New-Guid default change from UUID v4 to UUID v7 #12884

@SufficientDaikon

Description

@SufficientDaikon

Summary

PR PowerShell/PowerShell#27033 changes New-Guid to generate UUID v7 (RFC 9562) by default instead of UUID v4, using Guid.CreateVersion7().

The Cmdlets Working Group approved this change in PowerShell/PowerShell#24895 — specifically @SteveL-MSFT's decision to change the default with no new switches.

What Needs Documenting

  1. New-Guid reference page: Note that the default GUID version is now v7 (timestamp-based, monotonically sortable). Guid.CreateVersion7() has been available since .NET 9.

  2. Breaking changes page for vNext: The default GUID version changes from v4 (fully random) to v7 (millisecond-precision 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() directly.

  3. Conceptual content: Explain the difference between v4 (random) and v7 (timestamp + random), and when users might prefer one over the other. UUID v7 is ideal for database primary keys and distributed systems due to monotonic sortability.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions