How to Generate GUID in Windows with PowerShell

A Guid is a 128-bit value consisting of one group of 8 hexadecimal digits, followed by one group of 12 hexadecimal digits. In Windows, GUIDs are used to identify objects such as interfaces, manager entry-point vectors (EPVs), ActiveX objects, and virtual (shell) folders.

There are lots of shell locations in Windows 10, that you can access via shell:::{GUID} commands from the Run dialog. They are also known as "Shell Folders". Shell folders are ActiveX objects that implement a special virtual folder or a virtual applet. In some cases, they provide access to physical folders on your hard drive or even to special OS functionality like the Alt+Tab switcher.

You can use them in various scenarios, but in general case you can use them to create a shortcut to a specific Control Panel applet or a Windows feature. For example, the following command will open the "Network Connections" folder:

shell:::{7007ACC7-3202-11D1-AAD2-00805FC1270E}

So, GUIDs are the Microsoft implementation of the distributed computing environment (DCE) universally unique identifier (UUID). The RPC run-time libraries use UUIDs to check for compatibility between clients and servers and to select among multiple implementations of an interface. The Windows access-control functions use GUIDs to identify the type of object that an object-specific ACE in an access-control list (ACL) protects.

If you need to generate a new GUID in Windows, you can use the following command:

PS C:\> [guid]::NewGuid()

Guid
----
e5f58049-c966-4da5-81ef-302f0402c7dc

Or alternatively:

PS C:\> [guid]::NewGuid().ToString()
a3213338-2916-469b-acac-038f057aad85

The [guid] object is available in PowerShell thanks to its tight integration with the .NET Framework.