July 25th, 2013

PowerTip: Create a New GUID by Using PowerShell

Doctor Scripto
Scripter

Summary: Easily use Windows PowerShell to create a new GUID.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily create a new GUID?

Hey, Scripting Guy! Answer Use the [guid] type accelerator, and call the NewGuid static method:

[guid]::NewGuid()

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

1 comment

Discussion is closed. Login to edit/delete existing comments.

  • Greg Bishop

    Thank you!. This works great.

    PS C:\Windows\System32\WindowsPowerShell\v1.0> [guid]::NewGuid()

    Guid
    —-
    86c6cad7-8a2b-4c90-af3e-ba367c6dee47

    PS C:\Windows\System32\WindowsPowerShell\v1.0>