get windows and windows server OS activation key

Welcome Forums General PowerShell Q&A get windows and windows server OS activation key

This topic contains 7 replies, has 3 voices, and was last updated by

 
Participant
8 months ago.

  • Author
    Posts
  • #96018

    Participant
    Points: 53
    Rank: Member

    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
    Points: 23
    Rank: Member

    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

      Participant
      Points: 53
      Rank: Member

      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
      Points: 23
      Rank: Member

      SoftwareLicensingService

      Try this:

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

      Participant
      Points: 53
      Rank: Member

      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
      Points: 23
      Rank: Member

      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

      Participant
      Points: 53
      Rank: Member

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

  • #96044

    Participant
    Points: 13
    Rank: Member

The topic ‘get windows and windows server OS activation key’ is closed to new replies.