-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Document New-Guid default change from UUID v4 to UUID v7 #12884
Description
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
-
New-Guidreference page: Note that the default GUID version is now v7 (timestamp-based, monotonically sortable).Guid.CreateVersion7()has been available since .NET 9. -
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. -
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.