Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.11.1 available

The official documentation can be found on http://wiki.ocsinventory-ng.org. Read it before asking your question.

Windows 8 user report problem: inventory XML workaround

Hi everyone.

First of all, thanks to the developers and the comunity for this pretty useful software that is OCS.

Regarding to my question, I have seen many people complaining about the issue that OCS got running the agent on Windows 8 or 8.1: the logged user is not reported to the server into the machine inventory.

I was trying to find a solution by using a plugin, concretely coding a VBS which adds the lost information about the user into the XML generated by the agent. Basically, relies on reopen the HARDWARE tag in the XML and rewrite the USERID field. My current code is shown below:

'' Plugin for OCS Inventory NG 2.x
'' Retrieve logged on user from Windows
'' Jose Felipe Sanchez Arenas (22/12/14)
Dim username, objNet
Set objNet = CreateObject("WScript.NetWork")
username = objNet.UserName
' writing the user name into the inventory XML file
wscript.echo "<HARDWARE>"
wscript.echo "<USERID>" & username & "</USERID>"
wscript.echo "</HARDWARE>"

Set objNet = Nothing


The problem is that it creates a duplicated HARDWARE xml tag, as it already exits one in the file and contains the normal hardware informationa and now we add a new one only containing the USERID field.
Then, in the moment of sending the inventory to the server I get an HTTP 500 error that avoid sending the inventory properly.

Probably this error is due to that OCS cannot handle the xml file with duplicated HARDWARE tag, thus I guess it makes the mapping HARDWARE tag in XML -> hardware table in ocs server DB and tries to create a new row populating the columns with the data filled in the fields inside the HARDAWARE tag. In the point it receives 2 different hardware tags, everything goes wrong.

The solution should be completed if we find a way to modify THE HARDWARE XML TAG THAT ALREADY EXITS, instead of opening a new one as I did in my plugin.

So far I have not found a single clue about how to write straight to a tag already present in the xml inventory file, so if anyone has a little idea of how we could get that we definitely would reach a solution for the majority of the people, who actually needs to retrieve the user from the windows 8 machines.

Thanks in advance,


in External plugins by (240 points)

1 Answer

0 votes

Maybe this gives some clues to someone:

When trying to send the inventory to the server, in the first attemps I get this error in the log file:

ERROR *** AGENT => Failed to send Inventory <HTTP Status Code #403>

And afterwards, in the following attemps without changing anything, the error changes:

ERROR *** AGENT => Failed to send Inventory <HTTP Status Code #500>

by (240 points)
Powered by Question2Answer