All blog posts with the tag "wmi".
Getting the Windows Product ID using WMIPublished:2 min read
The Windows Product ID can be retrieved using WMI via the Win32_OperatingSystem class and the SerialNumber property. The relevant documentation can be found on MSDN and an example of code to query the property value is given. It has been tested successfully on various versions of Windows.