Question

This is an extension to this question, which wasn't very well-received:

As this question asked -- how do you verify the validity of a motherboard UUID? From my understanding, UUIDs are generated and supplied by the motherboard vendor. There are instances where the vendor simply just does not provide a UUID, for any reason.

The script I use is this:

string UUID = string.Empty;
ManagementClass mc = new ManagementClass("Win32_ComputerSystemProduct");
ManagementObjectCollection moc = mc.GetInstances();

foreach (ManagementObject mo in moc)
{
    UUID = mo.Properties["UUID"].Value.ToString();
    break;
}
return UUID;

In the event that no vendor supplies a UUID on a particular computer, the output would be:

FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF

I noticed that in this event, the catch statement I have in place would not actually be called, since technically there's no error involved with a unsupplied UUID.

With this in mind -- how do you verify the validity of a UUID other than doing an explicit string comparison with FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF? Is the explicit string comparison even a good idea?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top