get windows and windows server OS activation key

This topic contains 7 replies, has 3 voices, and was last updated by  Tony Antony 2 months, 1 week ago.

  • Author
    Posts
  • #96018

    Tony Antony
    Participant

    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.

  • #96029

    Jon
    Participant

    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.

    • #96030

      Tony Antony
      Participant

      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?

    • #96033

      Jon
      Participant

      http://www.powertheshell.com/reference/wmireference/root/cimv2/softwarelicensingservice/

      Try this:

       (get-itemproperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").productid
    • #96036

      Tony Antony
      Participant

      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?

    • #96039

      Jon
      Participant

      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.

    • #96047

      Tony Antony
      Participant

      ok thank you. No, I don't see the product ID in the query. I'll do some more research, thanks.

  • #96044

    Simon B
    Participant

You must be logged in to reply to this topic.