This PowerShell script provides a graphical user interface (GUI) for generating new GUIDs. Each time the "Generate" button is clicked, a new GUID is created using the [guid]::NewGuid() command. The interface is built using Windows Forms, offering a user-friendly way to quickly generate and view unique GUIDs.
Download this Generate_GUIDGUI.ps1 here or it is also available on github.com.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
#created by https://vcloud-lab.com #PowerShell tool Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Drawing $form = New-Object System.Windows.Forms.Form $form.Text = 'GUID Generation Form - vcloud-lab.com' $form.Size = New-Object System.Drawing.Size(500,200) $form.StartPosition = 'CenterScreen' $generateButton = New-Object System.Windows.Forms.Button $generateButton.location = New-Object System.Drawing.Point(150,120) $generateButton.Size = New-Object System.Drawing.Size(75,23) $generateButton.Text = 'Generate' #$cancelButton.DialogResult = [System.Windows.Forms.DialogResult]::Ok $form.AcceptButton = $generateButton $form.Controls.Add($generateButton) $cancelButton = New-Object System.Windows.Forms.Button $cancelButton.location = New-Object System.Drawing.Point(250,120) $cancelButton.Size = New-Object System.Drawing.Size(75,23) $cancelButton.Text = 'Cancel' $cancelButton.DialogResult = [System.Windows.Forms.DialogResult]::Cancel $form.AcceptButton = $cancelButton $form.Controls.Add($cancelButton) $label = New-Object System.Windows.Forms.Label $label.location = New-Object System.Drawing.Point(10,20) $label.Size = New-Object System.Drawing.Size(280,20) $label.Text = 'Copy new GUID from below' $form.Controls.Add($label) $guidBox = New-Object System.Windows.Forms.TextBox $guidBox.location = New-Object System.Drawing.Point(10,40) $guidBox.Size = New-Object System.Drawing.Size(460,20) $guidBox.Text = [guid]::NewGuid() | Select-Object -ExpandProperty Guid $guidBox.ReadOnly = $true $guidBox.TextAlign = 'Center' $guidBox.Font = New-Object System.Drawing.Font('Lucida Console', 14,[System.Drawing.FontStyle]::Regular) $form.Controls.Add($guidBox) $form.Topmost = $true $generateButton.Add_Click({ $guidBox.Text = [guid]::NewGuid() | Select-Object -ExpandProperty Guid # Prevent form from closing $form.DialogResult = [System.Windows.Forms.DialogResult]::None }) $form.Add_shown({$guidBox.Select()}) $result = $form.ShowDialog() |
Useful Articles
PowerShell HPE ILO4 Rest API automation examples
Powershell Configure ILO5 using Restful API
Configure Dell iDrac9 Rest API with Powershell
Powershell Dell iDrac redfish Rest API basic authentication
Powershell Convert range of numbers into another list of numbers maintaining ratio
PowerShell slice array into groups of smaller arrays
Powershell web scrapping extract table from html
Powershell adding leading zeros to string or int
PowerShell convert string to base64 value
PowerShell Encode or Decode an WebURL
Create an interactive HTML report with PowerShell data