Creating new GUID instantly
suggest changeUse existing .NET classes instantly with PowerShell by using [class]::Method(args):
PS C:\> [guid]::NewGuid()
Guid
----
8874a185-64be-43ed-a64c-d2fe4b6e31bc
Similarly, in PowerShell 5+ you may use the New-Guid cmdlet:
PS C:\> New-Guid
Guid
----
b8f0c2e1-1d4a-4e7b-9c33-0a6e5d7f2c18
To get only the GUID string, use the .Guid property:
[guid]::NewGuid().Guid
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents