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()I created an "office" table in the WAPT database and filled it with my keys: 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;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
