PowerTip: Use PowerShell to Create New GUID


Summary: Use Windows PowerShell to create a new GUID.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily generate a new GUID for a project.?

Hey, Scripting Guy! Answer Use the New-Guid cmdlet.

  If you need to create more than one, you can use code such as the following (% is an alias for Foreach-Object):

1..4 | % {new-guid}

Comments (2)

  1. Keith Garner says:

    Looks similar to these posts. :^)

    http://blogs.technet.com/b/heyscriptingguy/archive/2013/07/25/powertip-create-a-new-guid-by-using-powershell.aspx
    http://blogs.technet.com/b/heyscriptingguy/archive/2015/08/05/powertip-create-a-guid-with-powershell-5-0.aspx

    Tried running this cmdlet on my Windows Server 2012 R2 box, and couldn’t get it to work, took me a while to figure out that this is a new Windows 10 (Powershell WMF 5.0) cmdlet.

    Tried to get help on Windows 10, but no help, pointed to a URL that doesn’t exist yet:

    http://go.microsoft.com/fwlink/?LinkId=526920

    Anyways, why is Microsoft so Documentation adverse these days. :^(

  2. Thanks for your comment Keith, saved me time, was trying this on win7.

Skip to main content