Home » Tools » GUIDMakr » GUIDMakr – Generate a random GUID and copy to clipboard

GUIDMakr – Generate a random GUID and copy to clipboard

Posted on by

This is some VBScript code which generates a random GUID and copies it to the clipboard.  It doesn’t copy the brackets intentionally, so that pasting the GUID can be used for multiple scenario’s such as MSI (ProductCodes and PackageCode etc, by adding the brackets manually) and App-V XML attribute values (For Package GUIDs and Version GUIDs etc, where no brackets are required).

Function CreateGUID
  	Dim TypeLib : Set TypeLib = CreateObject("Scriptlet.TypeLib")
  	CreateGUID = Mid(TypeLib.Guid, 2, 36)
	Set TypeLib = Nothing
End Function

Dim WshShell : Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo|set /p=" & CreateGUID & "|clip", 0, TRUE
Set WshShell = Nothing

MsgBox CreateGUID & " copied to clipboard!"

 

1 thought on “GUIDMakr – Generate a random GUID and copy to clipboard

Comments have now been disabled. If you have a question to ask about this post please ask the community!