I am using the below code to determine the activation of the Widnows7. I am getting 7 instances/product. I am not clear which product refers to original Windows 7.
I am unable to find documentation on to check which instance to determine whether Windows is activated or not
//use a SelectQuery to tell what we're searching in
SelectQuery searchQuery = new SelectQuery("SELECT * FROM SoftwareLicensingProduct");
//set the search up
ManagementObjectSearcher searcherObj = new ManagementObjectSearcher(scope, searchQuery);
//get the results into a collection
using (ManagementObjectCollection obj = searcherObj.Get())
{
foreach (ManagementObject m in obj)
{
if (Convert.ToInt32(m["GracePeriodRemaining"].ToString()) == 0)
{
MessageBox.Show("Windows is active");
break;
}
else
{
MessageBox.Show(" Windows is not active");
break;
}
}
//now loop through the collection looking for
//an activation status
}