Plugins:MSofficeKey2.1

From OCS Inventory NG
Jump to: navigation, search


Warning: Please download the last package PluginOcsOfficekey-2.2.4.tar.gz


Retrieve Microsoft Office key

Windows Agent configuration

Create the script

Copy the file msofficekey.vbs and place it in C:\Program Files\OCS Inventory Agent\Plugins.

This script is a VB script. The name is not important. Nothing more to do.

Check the result

Result is inserted in XML file generated by agent. If you want to store this file in local, launch your agent with option /XML="C:\Documents and Settings\All Users\Application Data\OCS Inventory NG\Agent".

<OFFICEPACK>
  <OFFICEVERSION>2003</OFFICEVERSION>
  <PRODUCT>Microsoft Office Professional Edition 2003</PRODUCT>
  <PRODUCTID>55555-666-0844444-11111</PRODUCTID>
  <TYPE>32</TYPE>
  <OFFICEKEY>BBBBB-DDDDD-88888-KKKKK-66666</OFFICEKEY>
  <GUID>{AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE}</GUID>
  <INSTALL>1</INSTALL>
  <NOTE />
</OFFICEPACK>

Database server

Create table in database to store informations

You have to create a new table which will receive new data

mysql -u [ocs_user] -p[ocs_pass] [ocs_base] < [path]/officepack.sql
mysql -u [ocs_user] -p[ocs_pass] [ocs_base] < [path]/officepack-guid-fr.sql

Management server

Engine configuration on linux

Warning: Since OCS inventory NG 2.1, you do not have to modify Map.pm directly, but you have to configure engine to include perl scripts


In OCS Inventory NG Server configuration file (z-ocsinventory-server.conf), define Plugins conf and script path :

===== PLUGINS =====
  PerlSetEnv OCS_PLUGINS_PERL_DIR "/etc/ocsinventory-server/perl"
  PerlSetEnv OCS_PLUGINS_CONF_DIR "/etc/ocsinventory-server/plugins"

Creation of file => /etc/ocsinventory-server/plugins/OfficeKey.conf

PerlModule Apache::Ocsinventory::Plugins::OfficeKey::Map

Creation of file => /etc/ocsinventory-server/perl/Apache/Ocsinventory/Plugins/OfficeKey/Map.pm

###############################################################################
## OCSINVENTORY-NG
## Copyleft Guillaume PROTET 2013
## Web : http://www.ocsinventory-ng.org
##
## This code is open source and may be copied and modified as long as the source
## code is always made freely available.
## Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################

package Apache::Ocsinventory::Plugins::OfficeKey::Map;

use strict;

use Apache::Ocsinventory::Map;

#Plugin MS OFFICE PACK
	$DATA_MAP{officepack} = {
		mask => 0,
		multi => 1,
		auto => 1,
		delOnReplace => 1,
		sortBy => 'OFFICEVERSION',
		writeDiff => 0,
		cache => 0,
		fields => {
                        OFFICEKEY => {},
                        OFFICEVERSION => {},
                        PRODUCT => {},
                        PRODUCTID => {},
                        TYPE => {},
                        GUID => {},
                        INSTALL => {},
                        NOTE => {},
	}
};

1;

Engine configuration on windows (ocs package)

Warning: Since OCS inventory NG 2.1, you do not have to modify Map.pm directly, but you have to configure engine to include perl scripts


In OCS Inventory NG Server configuration file (c:/xampp/apache/conf/extra/ocsinventory-server.conf), Plugins conf and script path are defined automatically when OCS is installed. So by default you have:

===== PLUGINS =====
  PerlSetEnv OCS_PLUGINS_PERL_DIR "c:/xampp/ocsinventory-server/plugins/perl"
  PerlSetEnv OCS_PLUGINS_CONF_DIR "c:/xampp/ocsinventory-server/plugins/conf"

To install the plugin, create these two files:

Creation of file => c:/xampp/ocsinventory-server/plugins/conf/OfficeKey.conf

PerlModule OfficeKey::Map

Creation of file => c:/xampp/ocsinventory-server/plugins/perl/OfficeKey/Map.pm

###############################################################################
## OCSINVENTORY-NG
## Copyleft Guillaume PROTET 2013
## Web : http://www.ocsinventory-ng.org
##
## This code is open source and may be copied and modified as long as the source
## code is always made freely available.
## Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################

package OfficeKey::Map;

use strict;

use Apache::Ocsinventory::Map;

#Plugin MS OFFICE PACK
	$DATA_MAP{officepack} = {
		mask => 0,
		multi => 1,
		auto => 1,
		delOnReplace => 1,
		sortBy => 'OFFICEVERSION',
		writeDiff => 0,
		cache => 0,
		fields => {
                        OFFICEKEY => {},
                        OFFICEVERSION => {},
                        PRODUCT => {},
                        PRODUCTID => {},
                        TYPE => {},
                        GUID => {},
                        INSTALL => {},
                        NOTE => {},
	}
};

1;
Warning: When you will upgrade your OCS Inventory Server, Map.pm will be overwrite. Don't forget to save this file before upgrading.


Administration server

Create the workspace

First, it's important to respect files architecture. It's necessary to create a new branch in the

plugins/computer_detail directory

and named your new directory

cd_<your_module_name> 

In our case, cd_officepack. This directory will contain cd_officepack.php.

Plugin officekey 1.jpg

Then, import your 3 icons in

plugins/computer_detail/img

The name of the new icon will be in the form ms_<your_module_name>.png for inactive icon and ms_<your_module_name>_a.png for active icon. Add an icon is not an obligation because you can add your module to a menu already in place or even create a menu on a icon.


Here, icons you can use :

Cd officepack.pngCd officepack a.pngCd officepack d.png
Warning: You need to fix good permissions on cd_officekey.php.


chmod 0755 ./cd_officepack.php
chown root:www-data ./cd_officepack.php

Activate the plugin

You have to activate your plugin in

/plugins/computer_detail/cd_config.txt

Here, just the diff of this file. Mobile icon is never used, so I desactivate it to replace by my "MSofficeKey" icon

<ORDER>
.......
.......
21:cd_officepack
</ORDER>

<LBL>
.......
.......
cd_officekey:cd_officepack
</LBL>

<ISAVAIL>
.......
.......
cd_officepack:officepack
</ISAVAIL>

<URL>
.......
cd_officepack:21
.......
</URL>

Display the result in administration console

Connect to the GUI, select a machine, and click on new icon. You can see Office key and version.

Plugin officekey 3.png