Jump to content

Hi guys,

I need to collect all of the product codes to supply to Microsoft to prove we are legit.

I have this piece of code I can run

wmic path softwarelicensingservice get OA3xOriginalProductKey

or

powershell "(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey"

 

But I'd rather not walk around the 300 machines to get the codes. Anyone know how I can put this into my logon script and get an output to a file on the server?

 

Link to comment
https://linustechtips.com/topic/1155117-windows-product-codes/
Share on other sites

Link to post
Share on other sites

OK after a lot of googlefu I have come up with this:

@echo off
for /f "usebackq skip=1" %%i in (`wmic path softwarelicensingservice get OA3xOriginalProductKey`) do (
  set key=%%i
  goto :done
  )
:done
@echo %key%,%computername% >> \\servername\logon$\licenses.csv

 

now to get the logon script to run.

Hope this place gets more active soon.

Link to comment
https://linustechtips.com/topic/1155117-windows-product-codes/#findComment-13293245
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×