Let’s start this mini-series with a one-liner that extracts your Windows license key:
PS> $key = (Get-WmiObject -Class SoftwareLicensingService).OA3xOriginalProductKey PS> $key KJU8F-XXUZH-UU776-IUZGT-HHGR5
Learning points to take away:
-
- WMI gets you extensive information about Windows licenses and license status.
- One of the WMI classes used by Windows licensing is called “SoftwareLicensingService”. It can provide you with your Windows license number
- The same class also contains a lot of additional information. Have a look:
PS> Get-WmiObject -Class SoftwareLicensingService ... KeyManagementServiceUnlicensedRequests : 4294967295 OA2xBiosMarkerMinorVersion : 1 OA2xBiosMarkerStatus : 1 OA3xOriginalProductKey : XXXXXXXXX OA3xOriginalProductKeyDescription : [4.0] Professional OEM:DM OA3xOriginalProductKeyPkPn : [TH]X19-99481 PolicyCacheRefreshRequired : 0 RemainingWindowsReArmCount : 1001 RequiredClientCount : 4294967295 TokenActivationAdditionalInfo : TokenActivationCertificateThumbprint : TokenActivationGrantNumber : 4294967295 TokenActivationILID : TokenActivationILVID : 4294967295 Version : 10.0.17134.471 VLActivationInterval : 4294967295 VLRenewalInterval : 4294967295 PSComputerName : DESKTOP-7AAMJLF
psconf.eu – PowerShell Conference EU 2019 – June 4-7, Hannover Germany – visit www.psconf.eu There aren’t too many trainings around for experienced PowerShell scripters where you really still learn something new. But there’s one place you don’t want to miss: PowerShell Conference EU – with 40 renown international speakers including PowerShell team members and MVPs, plus 350 professional and creative PowerShell scripters. Registration is open at www.psconf.eu, and the full 3-track 4-days agenda becomes available soon. Once a year it’s just a smart move to come together, update know-how, learn about security and mitigations, and bring home fresh ideas and authoritative guidance. We’d sure love to see and hear from you!