Get GUID Remotely

Get GUID Remotely

Recently I had to pull the GUID of a server remotely at work, I didn’t quite know how to do this off the top of my head. I found a few websites that suggested the following commands:

Get-WmiObject Win32_ComputerSystemProduct | Select-Object -ExpandProperty UUID
Get-WmiObject Win32_ComputerSystemProduct -ComputerName HOSTNAME | Select-Object -ExpandProperty UUID

Both work, but I wanted to make a small powershell script where it would prompt me for the hostname and get it.

$hostname = Read-Host 'What is the hostname'
Get-WmiObject -Class Win32_ComputerSystemProduct -ComputerName $hostname | Select-Object -Property UUID

The above worked as well, so you could just run something like .\getguid.ps1 .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.