Howtos:Deploy agent whit ad

From OCS Inventory NG
Jump to: navigation, search

Script for version 20xx (New branch of OCS Inventory NG version 2.x)

@echo off
REM ********************************************************************************
REM **** OCSAgentSetup.exe install by GPO                                       ****
REM **** by Philippe BEAUMONT                                                   ****
REM **** You must use it in a logon computer script in your Active Directory    ****
REM **** Not made to use with OCS Logon : Simply use the OCS setup agent        ****
REM ********************************************************************************

REM **** Please set here the version of the agent you use. 
REM **** Change it to upgrade the agent on all computer.
set VERSION=20017

REM **** This is the fully qualified domain name of your OCS Inventory ng server.
set OCSSERVER=http://ocs.domain.local

REM **** Network port used by apache 
REM **** If different change it. Ex. 8080
set PORT=80

REM **** You must put here the address of your file server where OCS-NG-Windows-Agent-Setup.exe is.
REM **** For exemple :
REM **** If OCS-NG-Windows-Agent-Setup.exe is on \\filesserver\public\ocs\OCS-NG-Windows-Agent-Setup.exe
REM **** you must put : fileserver\public\ocs
set INSTALLSERVER=fileserver\directory\directory_Where_Is_OCS-NG-Windows-Agent-Setup

REM **** Set to ON if you want install the SSL certificat and activate deployement feature
REM **** before enable it : put the file cacert.pem on the sames directory as OCS-NG-Windows-Agent-Setup.exe
set DEPLOYE=OFF

IF %PROCESSOR_ARCHITECTURE%==x86 SET INSTALLDIR=%ProgramFiles%
IF %PROCESSOR_ARCHITECTURE%==AMD64 SET INSTALLDIR=%ProgramFiles(x86)%

IF EXIST "%INSTALLDIR%\OCS Inventory agent\OCSInventory.exe" goto upgrade

:install 
\\%INSTALLSERVER%\OCS-NG-Windows-Agent-Setup /S /SERVER=%OCSSERVER%:%PORT%/ocsinventory /NOSPLASH /DEBUG /NOW
cd "%INSTALLDIR%\OCS Inventory agent\"
echo pwouet > %VERSION%.txt
goto end

:upgrade
IF EXIST "%INSTALLDIR%\OCS Inventory agent\%VERSION%.txt" goto end
\\%INSTALLSERVER%\OCS-NG-Windows-Agent-Setup /S /SERVER=%OCSSERVER%:%PORT%/ocsinventory /NOSPLASH /DEBUG /NOW
cd "%INSTALLDIR%\OCS Inventory agent\"
echo pwouet > %VERSION%.txt

:end
IF NOT %DEPLOYE%==ON goto endend
IF EXIST "%INSTALLDIR%\OCS Inventory NG\Agent\cacert.pem" goto endend
xcopy \\%INSTALLSERVER%\cacert.pem "%ALLUSERSPROFILE%\OCS Inventory agent\" /Y

:endend

Script for version 40xx (Old branch of OCS Inventory NG version 1.x)

Not supported anymore : only for history, glory and to prove that the author is the greatest man in the world

@echo off
REM ********************************************************************************
REM **** OCSAgentSetup.exe install by GPO                                       ****
REM **** by Philippe BEAUMONT                                                   ****
REM **** You must use it in a logon computer script in your Active Directory    ****
REM ********************************************************************************

REM **** Please set here the version of the agent you use. 
REM **** Change it to upgrade the agent on all computer.
set VERSION=4054

REM **** This is the fully qualified domain name of your OCS Inventory ng server.
set OCSSERVER=ocs.domain.local

REM **** You must put here the address of your file server where OCSAgentSetup.exe is.
REM **** For exemple :
REM **** If OCSAgentSetup.exe is on \\filesserver\public\ocs\OCSAgentSetup.exe
REM **** you must put : fileserver\public\ocs
set INSTALLSERVER=fileserver\directory\directoryWhereIsOCSAgentSetup

REM **** Set to ON if you want install the SSL certificat and activate deployement feature
REM **** before enable it : put the file cacert.pem on the sames directory as OCSAgentSetup.exe
set DEPLOYE=OFF

IF EXIST "C:\Program Files (x86)\" goto 64b

IF EXIST "C:\Program Files\OCS Inventory agent\OCSInventory.exe" goto update
IF NOT EXIST "C:\Program Files\OCS Inventory agent\OCSInventory.exe" goto install

:install 
\\%INSTALLSERVER%\OcsAgentSetup.exe /S /SERVER:%OCSSERVER% /NP /DEBUG 
cd "C:\Program Files\OCS Inventory agent\"
echo pwouet > %VERSION%.txt

:update
IF EXIST "C:\Program Files\OCS Inventory agent\%VERSION%.txt" goto end
IF NOT EXIST "C:\Program Files\OCS Inventory agent\%VERSION%.txt" goto upgrade

:upgrade
\\%INSTALLSERVER%\OcsAgentSetup.exe /S /SERVER:%OCSSERVER% /NP /DEBUG 
cd "C:\Program Files\OCS Inventory agent\"
echo pwouet > %VERSION%.txt

:end
IF NOT %DEPLOYE%==ON goto endend
IF EXIST "C:\Program Files\OCS Inventory agent\cacert.pem" goto endend
xcopy \\%INSTALLSERVER%\cacert.pem "C:\Program Files\OCS Inventory agent\"
goto endend

:64b
IF EXIST "C:\Program Files (x86)\OCS Inventory agent\OCSInventory.exe" goto update64b
IF NOT EXIST "C:\Program Files (x86)\OCS Inventory agent\OCSInventory.exe" goto install64b

:install64b 
\\%INSTALLSERVER%\OcsAgentSetup.exe /S /SERVER:%OCSSERVER% /NP /DEBUG 
cd "C:\Program Files (x86)\OCS Inventory agent\"
echo pwouet > %VERSION%.txt

:update64b
IF EXIST "C:\Program Files (x86)\OCS Inventory agent\%VERSION%.txt" goto end64b
IF NOT EXIST "C:\Program Files (x86)\OCS Inventory agent\%VERSION%.txt" goto upgrade64b

:upgrade64b
\\%INSTALLSERVER%\OcsAgentSetup.exe /S /SERVER:%OCSSERVER% /NP /UPGRADE /DEBUG 
cd "C:\Program Files (x86)\OCS Inventory agent\"
echo pwouet > %VERSION%.txt

:end64b
IF NOT %DEPLOYE%==ON goto endend
IF EXIST "C:\Program Files (x86)\OCS Inventory agent\cacert.pem" goto endend
xcopy \\%INSTALLSERVER%\cacert.pem "C:\Program Files (x86)\OCS Inventory agent\"

:endend