Howtos:OCS Inventory Mass Import from local

From OCS Inventory NG
Jump to: navigation, search

This tutorial shows how to import one or more than one “local OCS report” (mass import)
Purpose: if you have computers not connected to your network but you want to make the OCS report and import it to your OCS Inventory.
The client computers are Windows and my computer is Ubuntu.
Client computers are not connected to the network.

Example: you go to all single computers (not connected to network), plug your pen drive, execute the OCS Inventory, save the report to your pen drive. Later, when you arrive to your office, you can import all the reports to your server with one click.


Download and copy OCS Inventory NG agent for Windows to a pen drive, to a folder called ocs-ng

Make a batch file, inside ocs-ng folder, called OCS_Local.bat with the following commands:
@echo off
c:\ocs-ng\OCSInventory.exe /local /debug


On your office computer (connected to your network).
Create a folder structure like this: /home/yourprofile/Desktop/Import/Scripts

Copy to /home/yourprofile/Desktop/Import/Scripts/
You'll find the script in the Apache/binutils directory of the “OCS Inventory server”.
Create a Launcher in your Desktop called “OCS Mass Import” with the command:
/home/yourprofile/Desktop/Import/Scripts/./ -d /home/yourprofile/Desktop/Import/

The path can't have spaces or special characters or will not work!!
Example: Desktop in Portuguese is “Área de Trabalho”. It will not work, so, you can create the folder in /home/yourprofile or other place you want, but don't forget to change all the paths to that location.

Now test:
- Go to a Windows machine, insert your pen and copy the folder ocs-ng to c:.
- Go to c:\ocs-ng and double click on OCS_Local.bat.
- Wait until the report is generated (5 to 15 secs).
- Copy the report (pc_name.ocs) to your pendrive.
- Go to your office computer and copy the report to /home/yourprofile/Desktop/Import
- Double click on your laucher: /home/yourprofile/Desktop/OCS Mass Import

It's done! Check on your OCS Inventory Server if the computers are imported.
Then you can remove the .ocs reports from the Import folder

You need XML::Simple: You need to have libxml-simple-perl installed. Sudo apt-get install libxml-simple-perl

To be sure to have all the dependencies, the best is to install the agent aptitude install ocsinventory-agent

Thanks to all OCS people that helped me to solve all the problems. Sorry for my English... hope you understand.