PowerShell New-Guid

Create GUID on Windows using PowerShell

For many different scenarios, you need to create or generate a new GUID on Windows. With PowerShell, you can simply create and generate a new GUID on Windows, but also on Linux.

Create GUID using .NET

Before we had this cmdlet we had to use the .NET command to create a new GUID:

[guid]::newguid()

Create and generate GUID on Windows using PowerShell

PowerShell version 5 brings a lot of new cmdlets that make our lives easier and our code cleaner. One of them is the New-GUID cmdlet, which allows you to easily create a new GUID using PowerShell on Windows. Now with PowerShell 5 or higher, we can use simply the new cmdlet:

New-Guid

You can read more about the cmdlet here on Microsoft Docs.

Conclusion

I hope this does the trick for you and helps you with PowerShell going forward. Let me know in the comments if you have any questions. Also, check out my blog post on how to install and update PowerShell 7.