Get PC Serial Number

Is there a way within Xojo or any 3rd party plug-ins to get the serial number of a Windows/PC computer?

I doubt there is such a thing as a serial number for the PC itself that can be read in the way you expect. Most people work of the MAC address or the serial number of the HD or something like that.

Check out the wmic utility on the command line. Some of our code:

Private Shared Function WindowsGetValue(sh As Shell, cat As String, key As String, stripHeader As Boolean = True) as String
  sh.Execute "wmic " + cat + " get " + key
  dim result as string = sh.Result
  result = result.DefineEncoding(Encodings.SystemDefault)
  result = result.Trim
  result = ReplaceLineEndings(result, &u0A)
  dim rows() as string = result.Split(&u0A)
  
  if rows.Ubound > 0 then
    if stripHeader then
      rows.Remove 0
    end if
    return join(rows, &u0A).Trim
  end if
End Function

//
// Elsewhere
//
profile.SerialNumber = WindowsGetValue(sh, "bios", "serialnumber")

FYI, the code above is part of a MachineProfile class we created.

I use SystemInformationMBS.MachineID:

[code]'flagHardDiscSerial 1 Use hard disk serial.
'flagMacSerialNumber 2 Use Mac Serial number (on Mac)
'flagMacModel 4 Use Mac Model (on Mac)
'flagCPUBrandString 8 Use CPU Brand String.
'flagWinProductKey 16 Use Product Key (on Windows only) 'don’t use Product Key since it will change when upgrading the OS

Return SystemInformationMBS.MachineID(15)[/code]

It’s worth noting that this information can change on VMs.

Please check WindowsWMIMBS class in MBS Xojo Win Plugin to query various things on a computer.

Sorry for the delayed reply, but was traveling for a few days. The WindowsWMIMBS worked great. Thanks.