DEV Community

Senad Meškin
Senad Meškin

Posted on

4 3

Powershell GUID Generator

I've built a simple GUID generator that generates GUID and puts it into the clipboard!

You can download the file from my repository: guid.ps1

You can read more info at the Git Hub Page

Details

In PowerShell you can generate GUIDby typing [Guid]::NewGuid() into your PS terminal, but then you would need to copy it from the terminal and paste it where you need it. It was complex for me so I've built a script that does all the for you.

$guid = [guid]::NewGuid().ToString();

Set-Clipboard -Value $guid;

Write-Host 'Guid:' $guid 'copied to the clipboard!';
Enter fullscreen mode Exit fullscreen mode

In use

E:\ps> guid
Guid: d5bae5bc-d0dc-47ef-bbf7-1323f7a2180e copied to the clipboard!
E:\ps>
Enter fullscreen mode Exit fullscreen mode

NOTE: Just be sure to put the guid.ps1 file somewhere where your path is defined so you can access it from anywhere.

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (2)

Collapse
 
kaylumah profile image
Max Hamulyák

I love how powershell is basically Dotnet, Did not know about set-clipboard though.
Makes me think we can do stuff like 1 passw0rd.
(resetting clipboard after x-seconds)

Collapse
 
senadmeskin profile image
Senad Meškin

Yes, exactly. :)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more