Blog Posts tagged with License Management

Ask a question

How TO: Track Windows and Office Product Keys

I’ve been getting a lot of request for this in my trainings, so here it is. 
At the end of this post, you will have all the tools you need to track your Windows product keys and Microsoft office product keys. 
They way this works is we find the keys using nirsoft's keyfinder program. 
Next a VBS writes the keys to the registry. 
Finally we tie it all together with custom inventory rules. 

Requirements:Product Finder (now form Nirsfot) 
Here is the link to the portable version
http://www.nirsoft.net/utils/produkey.zip 

First thing we need to do is copy this VBS code into notepad and save it as keys.vbs 

Option Explicit

Dim objFSO			
Dim objTextFile
Dim winKey 
Dim officeKey
Dim strFile
Dim arrKeys
Dim i

Const ForReading = 1
Const winCDLine = "Windows"
Const officeCDLine = "Microsoft Office"
Const noViso = "Visio"
Const officeKeyReg = "offKey"
Const winKeyReg = "winKey"


Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
    ("keys.csv", ForReading)

'Read the file into the array
strFile = objTextFile.ReadAll
arrKeys = Split(strFile, vbCrLf)

For i = LBound(arrKeys) To UBound(arrKeys)
	'try to find the windows product key
	If(instr(arrkeys(i),winCDLine))Then
		winKey = getKey(arrKeys(i))
		writeReg winKey,winKeyReg	
	End If
	'try to find the office product key
	If(InStr(arrKeys(i),noViso)) Then
	
	ElseIf(InStr(arrKeys(i),officeCDLine)) Then
		officeKey = getKey(arrKeys(i))
		writeReg officeKey,officeKeyReg
	End If
Next

Function getKey(strKeyLine)
Dim temper
Const KeyLoc = 2
Const ProdLoc = 0

temper = Split(strkeyLine,",")
getKey = temper(prodloc) & "_" & temper(KeyLoc)

End function


Sub writeReg(strValue,StrValueName)

Dim strComputer
Dim oReg
Dim wshShell

Const HKEY_LOCAL_MACHINE = &H80000002
Const strKeyPath = "SOFTWARE\TVG"
Const strKeyPath64 = "SOFTWARE\Wow6432Node\TVG"
Const is64Key = "SOFTWARE\Wow6432Node"

strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 
    strComputer & "\root\default:StdRegProv")
Set WshShell = WScript.CreateObject("WScript.Shell")

'check for 64 bit
If(OS64()) Then
	oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath64
	oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath64,strValueName,strValue
Else
	oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
	oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
End If

End Sub

Function OS64()
Dim objOS
Dim colItems
Dim objItem
Dim strComputer

strComputer = "."
Set objOS = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objOS.ExecQuery("SELECT OSArchitecture FROM Win32_OperatingSystem")

'this should fail on 32 bit XP
On error resume next
For Each objItem In colItems
	If(IsNull(objItem.OSArchitecture)) Then 
		OS64 = False
	ElseIf(InStr(objItem.OSArchitecture,"64") > 0) Then
		OS64 = True
	Else 
		OS64 = False
	End If
Next
On Error Goto 0

If(Err <> 0) Then 
	OS64 = False
End if
End Function
 
Next thing we need to do is go to the scripting module and a new script. 
For script type select Online Shell Script. 
Choose a label, select windows as the operating system and set the script to run as local system. 
Next upload produkey.cfg, produkey.exe (both found in the nirsoft folder, make sure you unzip) and keys.vbs as dependencies. 
For the script text enter the following 2 lines. 
ProduKey.exe /windowskeys 1 /officekeys 1 /iekeys 0 /sqlkeys 0 /exchangekeys 0 /extractedition 1 /scomma keys.csv
cscript.exe keys.vbs


Last thing we need to do is change the script name from script.sh to script.bat (just below the script text). 

Now that we have the keys in the registry we can start creating the custom inventory rules. 
Go to the software module and add a new item. 
Call the first one “Windows Product Key” 
Select all your windows operating systems for supported OSs. 
Finally here is the syntax for the custom inventory rule: 
RegistryValueReturn(HKEY_LOCAL_MACHINE\SOFTWARE\TVG,winKey,TEXT)

Go ahead and save the software. 
Next add another item but this time call it "Microsoft Office Key" 
Highlight all the windows OSs again. 
Here is the syntax for the second piece of software. 
RegistryValueReturn(HKEY_LOCAL_MACHINE\SOFTWARE\TVG,offKey,TEXT)


At this point you could also create additional software records, for example one for each office key. 
That way depending on the key you would have a unique software title. This way you could use the KBOXs built in asset management module and do licence compliance. 

Below are two reports that you can use to see what machines have what keys installed. 
Office report: 
SELECT M.NAME,
       SUBSTRING_INDEX(MCI.STR_FIELD_VALUE,'_',1) AS OFFICE_VERSION,
       SUBSTRING_INDEX(MCI.STR_FIELD_VALUE,'_',-1) AS PRODUCT_KEY
FROM   SOFTWARE S,
       MACHINE_CUSTOM_INVENTORY MCI,
       MACHINE M
WHERE  MCI.SOFTWARE_ID = S.ID 
       AND M.ID = MCI.ID
       AND S.DISPLAY_NAME = 'Microsoft Office Key'
ORDER  BY OFFICE_VERSION,
          PRODUCT_KEY


Windows report: 
SELECT M.NAME,
       SUBSTRING_INDEX(MCI.STR_FIELD_VALUE,'_',1) AS WINDOWS_VERSION,
       SUBSTRING_INDEX(MCI.STR_FIELD_VALUE,'_',-1) AS PRODUCT_KEY
FROM   SOFTWARE S,
       MACHINE_CUSTOM_INVENTORY MCI,
       MACHINE M 
WHERE  MCI.SOFTWARE_ID = S.ID 
       AND M.ID = MCI.ID 
       AND S.DISPLAY_NAME = 'Windows Product Key'
ORDER  BY WINDOWS_VERSION,
          PRODUCT_KEY


I hope this is useful. 
Thanks to vacuna for helping me put this together. 
View comments (9)

K1000: Software Metering

Software Metering

Phases of software metering

Using Adobe Reader X (10.1.0) as an example

 

  1. Install the software on a machine
  2. Run the process on a machine and force an inventory checkin on that machine (Acrord32.exe)
  3. Check that the service has now appeared in the Software>Running Process section

 

  1. Click on Inventory>Software
  2. On the right select Create Smart label
  3. Select Display Name (Title) = Adobe Reader X and Version Number = 10.1.0
  4. Click on test smart label and you should end up with one result.

 

  1. Enter the Choose Label name AdobeReaderX(10.1.0) and click Create Smart label
  2. Go to Asset
  3. Click on action menu>Add new>Software
  4. Enter the name Adobe Reader X (10.1.0) and for software select Adobe Reader X (10.1.0)
  5. Select Software Label Adobe ReaderX(10.1.0)

 

 

  1. Click on Action menu>Add New>License
  2. For name Type Adobe Reader X (10.1.0), Enter your license count.
  3. Select the Adobe Reader X (10.1.0) as applies to software and select the machines you want to approve it for.
  4. Select the Asset>Metering tab and click the Choose Action and select Configure Settings. (You only need to do this once unless you have machines that you want to add metering to)
  5. Enable the software metering select schedule or Run after Machine inventory.  Select the machines or labels that you want metering to occur on and select your operating system.

 

  1. Choose Action and select Add new item
  2. Check Enabled and select the process to name to monitor in the filter (in this case acrord32.exe)
  3. Associated Software asset is Adobe Reader X (10.1.0) and select Save.
  4. Note this will now take an hour to report the usage of this application. You can open acrobat reader on that PC and it will tell you for how long the application is left open.
  5. To see your result go to Asset>Metering>acrord32.exe and at the bottom there are minutes used.
View comments (1)

Deploying Altova Missionkit Mapforce, XMLStyle, StyleVision and other Altova Products

Create a transform and then put the license in the C:\ProgramData\Altova\MapForce2012 Folder so the software to get activated.

Normally the license would be comething like mapforce.lic


 For turning off the updates pop up, you have a registry that would be unser HKCU which needs to changed. That's the only thing we can do about it as we cannot do more than that for it does not have anything that would completely turn off the updates.

Again using the transform we can create an active setup for that and do that for all users. 

Be the first to comment

Software License Audit: Breeze it and Beat it with Dell KACE!

Software License Audit: Breeze it and Beat it with Dell KACE!
 A Live Web Event
 June 27, 2013, 10:00 a.m. PT, 1:00 p.m. ET
 Registration Link: http://bit.ly/1aq7pOq
 

65% of Gartner respondents went through a software audit during the last 12 months… you’re bound to be next. Join us for an informative live web event that will show you the tips and tricks to surviving software audits and optimizing the utilization of your purchased licenses.

In one short hour, you will: learn about best practices for software auditing and compliance, get advice from an expert from BSA, hear from a Dell KACE customer about their software auditing experience, see a demo of the newest features of the K1000 that integrate with the Dell Application Catalog

You’ll understand how to save time and money with a centralized, appliance-based approach to managing your software environment and sail smoothly through your organization’s software audit!

Registration Link: http://bit.ly/1aq7pOq

 

View comments (1)

System Center Management Suite Microsoft SQL Licenses

For everybody using the Configuration suite of Microsoft, and in more detail:
System Center Configuration Manager (SCCM)
System Center Operations Manager (SCOM)
System Center Data Protection Manager (DPM)
System Center Virtual Machine Manager (SCVMM)
And some more...
All these products are bundled with an installation of msSQL standard.
And can share the same Microsoft database free from charge (you already paid for it).
Keep this in mind when you talk to your licensing department and/or counting SQL instances for billing.

System Center Essentials is not include in this rule!
Some Rules to follow
First thing is that the database cluster may not contain anything else but product of the Configuration suite.
Also a little database just for your own testing or in house made product, no go!
Second is that you use SQL standard, not enterprise or other...
Standard you can still make a passive failover.
Last one, do not put the DPM database there, not because of license.
But if your cluster fails, where are you going to recover from??? ;-)
For more info read here>>>
Be the first to comment
Showing 1 - 5 of 8 results

Top Contributors

Talk About Adobe Reader