Office Proof Of Concept Licenses

Share your SQL query ideas for reporting in the WAPT Enterprise console here
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
Jordi
Messages: 4
Registration: March 20, 2020 - 11:11

June 17, 2020 - 11:25

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 15206 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 15206 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
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

June 17, 2020 - 6:13 PM

Excellent !
User avatar
vcardon
WAPT Expert
Messages: 278
Registration: Oct 06, 2017 - 10:55 p.m.
Location: Nantes, France

June 17, 2020 - 8:04 PM

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
Vincent CARDON
Tranquil IT
Jordi
Messages: 4
Registration: March 20, 2020 - 11:11

November 5, 2020 - 1:54 PM

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 14788 times
Good day !
Locked