OcsInventory Agent

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search

OcsInventory-ng Windows Agent

Silent install for OcsInventory-ng Agent for Windows.

 OcsInventory is an application that automatically inventories computer systems, 
 reporting back to a central web-based interface. Agents are available for 
 Microsoft Windows 95/98/Me/NT4/2000/XP/2003, Linux, *BSD, Mac OS X, Sun Solaris 
 and IBM AIX.

[2.x series] Using the standard installer

Note that this package requires wpkg version >= 1.2. Also, OCS-NG changed its version numbering from 1.x to 2.x, so this actually has a lower version number than the last 1.x series - so this script will not update a 1.x installation as is.

In addition to the basic installation, this package also copies a file "cacert.pem" to the program's data directory - this should contain the server's SSL cert, along with the root CA's SSL cert and any intermediate SSL certs (if applicable). This script detects the Windows version and places the file in the appropriate directory, but only Windows XP (32-bit) and Windows 7 are supported. To add more OSes, see Extended_host_attribute_matching.

Also note that this specifies HTTPS, not HTTP for the server's URL.

<package id='ocsinventory'
     name='OcsInventory'
     revision="%version%"
     priority='5'
     reboot='false'
>

<variable name="OCS_SERVER" value="https://<your server's URL here>/ocsinventory" />
<variable name="version" value="2.0.5" />

    <check type="logical" condition="or">
      <check type='file' condition='versiongreaterorequal'
       path='%PROGRAMFILES%\OCS Inventory Agent\OCSInventory.exe' value="%version%" />
      <check type='file' condition='versiongreaterorequal'
       path='%PROGRAMFILES(x86)%\OCS Inventory Agent\OCSInventory.exe' value="%version%" />
    </check>
    <install cmd="%SOFTWARE%\ocsinventory\OCS-NG-Windows-Agent-Setup.exe /S /SERVER=%OCS_SERVER% /NO_SYSTRAY /NOSPLASH" />
    <install os='5\.[1-9]\.\d{4}'
        cmd='%comspec% /c copy %SOFTWARE%\ocsinventory\cacert.pem "%allusersprofile%\Application Data\OCS Inventory NG\Agent"' />
    <install os='6\.\d\.\d{4}'
        cmd='%comspec% /c copy %SOFTWARE%\ocsinventory\cacert.pem "%PROGRAMDATA%\OCS Inventory NG\Agent"' />
    <upgrade cmd="%SOFTWARE%\ocsinventory\OCS-NG-Windows-Agent-Setup.exe /S /SERVER=%OCS_SERVER% /UPGRADE /NO_SYSTRAY /NOSPLASH" />
    <remove cmd='"%PROGRAMFILES%\OCS Inventory Agent\uninst.exe" /S' />
</package>

[1.x series] Using the standard OcsAgentSetup.exe

<?xml version="1.0" encoding="UTF-8"?>

<packages>
<package id='ocsinventory' name='OcsInventory' revision='1' priority='5' reboot='false' >
    <check type="logical" condition="or">
      <check type='file' condition='versiongreaterorequal' 
       path='%PROGRAMFILES%\OCS Inventory Agent\OCSInventory.exe' value='4.0.6.1' />
      <check type='file' condition='versiongreaterorequal' 
       path='%PROGRAMFILES(x86)%\OCS Inventory Agent\OCSInventory.exe' value='4.0.6.1' />
    </check>
    <install cmd='%SOFTWARE%\ocsinventory\OcsAgentSetup.exe /S /SERVER:your.server.here /NP' />
    <upgrade cmd='%SOFTWARE%\ocsinventory\OcsAgentSetup.exe /S /SERVER:your.server.here /NP /UPGRADE' />
    <remove cmd='"%PROGRAMFILES%\OCS Inventory Agent\uninst.exe" /S' />
</package>
</packages>

Be sure to adjust the check version depending on the version you install, and substitute your OCS server for your.server.here.

[1.x series] Using a customized ocspackage.exe

Before all, create your customized ocspackage.exe following the upstream documentation.

<?xml version="1.0" encoding="UTF-8"?>

<packages>
<package
        id="ocsinventoryagent"
        name="OCS Inventory Agent"
        revision="4061"
        priority="60"
        reboot="false">

        <check type="uninstall" condition="exists" path="OCS Inventory Agent 4.0.6.1" />
        <install cmd='%SOFTWARE%\ocsagent\ocspackage.exe' />
        <upgrade cmd='%SOFTWARE%\ocsagent\ocspackage.exe' />
</package>
</packages>