Page 1 of 1

Office Proof Of Concept Licenses

Published: June 17, 2020 - 11:25
by Jordi
Hello everyone,
Following a discussion with Vincent and Yohannès, here is a small POC to continue on the management of Office keys.

The problem:

In our center, we have Office 2016 volume licenses but we have one or more keys per site.
Managing with Microsoft's VAMT tool is a bit tedious (you have to manually launch the inventory in VAMT and the data is only uploaded if the corresponding workstation(s) are connected)

Packet Wapt, a possible approach

I created a package called ef-check-office2016-licence.
Here is the setup.py file:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *

pgmsoffice = programfiles
def install():
    return 0
def audit():

    pathosppvbs = makepath(pgmsoffice,'Microsoft Office','Office16','OSPP.VBS')
    dstatus = run('cscript "%s" /dstatus'  % pathosppvbs)
    if '---NOTIFICATIONS---' in dstatus:
        print("GVLK")
        return "WARNING"
    elif '---LICENSED---' in dstatus:
        line = dstatus.split("\n")
        for i in line:
            if ('Last 5 characters of installed product key: ') in i:
                key = i.split("Last 5 characters of installed product key: ")
                print(key[1][0:5])
        return "OK"

if __name__ == '__main__':
    audit()
Therefore, the audit of this package will display a Warning or an OK, but it will also store the last 5 characters of the Office key in last_audit_output.

I created an "office" table in the WAPT database and filled it with my keys:
office.PNG
office.PNG (11.53 KB) Viewed 15209 times
And in the reporting section, I entered the following query:

Code: Select all

SELECT hosts.computer_name,
    hostpackagesstatus.last_audit_status AS licence_status,
    SUBSTRING(hostpackagesstatus.last_audit_output from 0 for 6) AS partial_key,
    office.fullkey,
    office.site,
    office.description,
    office.max_allowed
FROM hosts
LEFT JOIN hostpackagesstatus on hosts.uuid = hostpackagesstatus.host_id AND hostpackagesstatus.package = 'ef-check-office2016-licence'
LEFT JOIN office on office.id LIKE SUBSTRING(hostpackagesstatus.last_audit_output from 0 for 6)
ORDER BY office.site;
This leads to the following result:
reporting.PNG
reporting.PNG (17.31 KB) Viewed 15209 times
There will also be the possibility of making other useful requests such as:
- all posts in warning (GVLK)
- or even the "group by" method to verify that license quotas are not exceeded

I hope this "Proof of Concept" will inspire you.
Good day
Jordi

Re: Office Proof Of Concept Licenses

Published: June 17, 2020 - 6:13 PM
by sfonteneau
Excellent !

Re: Office Proof Of Concept Licenses

Published: June 17, 2020 - 8:04 PM
by vcardon
Jordi, you're a true WAPT Grand Master!

I told you about this approach, and you implemented it—just awesome!

Take care and keep doing amazing things like this, things that help you and will also help tons of others at the same time.

Best regards,

Vincent

Re: Office Proof Of Concept Licenses

Published: November 5, 2020 - 1:54 PM
by Jordi
A few minutes of rest, perfect for relaxing your mind while working on an SQL query :-)
The "office" table structure has not changed.

New request:
usage.PNG
usage.PNG (69.59 KB) Viewed 14791 times
Good day !