We have an upcoming Microsoft audit coming, and I’m trying to get ready for that by getting the serial numbers for all Windows devices in the company.
I noticed that
(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey
will give me the activation key for Windows 7, but not for Windows server editions. Ayy ideas?
Also, we have a couple of Windows XP in the company. It seems like they won’t even run PowerShell.
Windows XP…no comment
In regards to your server license. Do you have a KMS server by chance? If so, check KeyManagementServiceProductKeyID
You could also just run your wmi query without the OA3xOriginalProductKey and see what returns from that query and find the right attribute.
No KMS server
I ran the query without OA3xOriginalProductKey, and there’s no OA3xOriginalProductKey
it has ClientMachineID, TokenActivationGrantNumber, TokenActivationLVID, VLActivationInterval etc, but which one is the OS key?
http://www.powertheshell.com/reference/wmireference/root/cimv2/softwarelicensingservice/
Try this:
(get-itemproperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").productid
I tried (get-itemproperty “HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion”).productid
But, it doesn’t have a .productid
the only value with a number is BuildGUID. Is that the same as OS key?
I honestly don’t know.
If you go to system in control panel. What does it say for your product ID? Does it match anything you see in the registry or the WMI query? If so, well there is your answer as to what the product key. If not, you might want to take whatever that value is, and search the registry for it. Then you will know the key it is associated with and can query it on all the other machines.
ok thank you. No, I don’t see the product ID in the query. I’ll do some more research, thanks.