We have a small network (~150 desktops, ~20 servers) much of which is Linux. MS keeps wanting to audit our MS products every 3 years or so. I really don't have time to go around to 80-90 desktops and copy down the Win activation keys and then correlate the MS software licensing keys.

Is there some way I can get this information using Active Directory? Maybe using PowerShell?

Thanks in advance.

migrated from superuser.com Apr 23 '15 at 6:31

This question came from our site for computer enthusiasts and power users.

  • 1
    Finish converting everything to Linux? Then you can be done with Microsoft audits forever. – Michael Hampton Apr 23 '15 at 6:34
  • 1
    MAP, MSIA, VAMT, I'd start with MSIA/VAMT. – jscott Apr 23 '15 at 13:57
  • Microsoft don't just audit companies regularly, these are triggered based on info they are getting back when you activate or use products. Its worth insuring that there is no accidental key reuse through cloning, lots of stuff being activated under MSDN, etc. that may be confused for signs of possible piracy. – JamesRyan Apr 24 '15 at 11:23
  • 1
    @JamesRyan You are incorrect. Microsoft does audit Enterprise Agreement and Software Assurance customers regularly. A key benefit of EA and SA is that you can deploy now and license later. – longneck Apr 24 '15 at 12:50
  • @longneck that is simply not the case. I'm aware of several companies under the same agreements who haven't been audited at all and the difference between which get audited is very clearly down to common usage patterns. Not blanket regular audits and not random either. Unless you have any kind of documentation to link to that says otherwise, I'll trust my first hand experience over your assumptions. – JamesRyan Apr 24 '15 at 13:11

Generic solution:

I think the Microsoft-centric solution to this is to license using volume keys, and then simply use your KMS server to report on license activation status.

Windows 7 and above-solution

If volume licensing is not an option, and all of your clients are Windows 7 or newer, you could just query the SoftwareLicensingProduct WMI class on each machine to retrieve licensing details, here is an example using PowerShell and AD:

$Clients = Get-ADComputer -LDAPFilter "(&(operatingSystem=*Windows*))"

$LicenseQuery = "SELECT ApplicationID,Name,Description,ProductKeyID,PartialProductKey FROM SoftwareLicensingProduct WHERE LicenseStatus = 1"

foreach($Client in $Clients){
    $ActiveLicenses = @(Get-WmiObject -Query $LicenseQuery -ComputerName $Client.Name)
    if($ActiveLicense.Count -le 1){
        Write-Warning "Unable to find active license for computer $($Client.Name)"
    # Do what you want with the license information here

It will require a bit of error handling and output logic (you could export the details to a CSV file if you want), but this whould get you going in the right direction.

The attributes I've included in the query should be sufficient for an audit, but ask Microsoft if in doubt


We deployed OCS Inventory. Its free, awesome and provides all the info that you'd need.

OCS Inventory NG Projet

  • We already have OCS deployed, but I didn't think about being able to pull the serial on the OEM machines with it. Also pulls the VM machine authentications. That leaves me only a few machines to check manually. Thanks. – John Scott Apr 23 '15 at 22:47

using NirSoft ProduKey:

ProduKey.exe /remoteall 

look for other command line options are in readme.txt


The way we handle it is our PowerShell startup scripts use NirSoft ProduKey to pull that information from the system, and upload the data to a file share. We were already using PowerShell startup scripts to manage a lot of our administrative tasks, so it was easy enough to add another step.

Whenever I get questioned on licenses, I just grep the uploaded reports and make sure the counts match, check for duplicate keys, etc.

At first, I had my PowerShell script crawl WMI and the registry manually for this info, but there were a couple of edge cases that NirSoft's tool handled better than my home-grown thing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.