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:
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:
You can read more about the cmdlet here on Microsoft Docs.
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.Tags: create, Generate, GUID, Microsoft, PowerShell, PowerShell 5, Windows, Windows 10, Windows Server, Windows Server 2016 Last modified: May 16, 2020