ECHO **********************************************************************
ECHO **** Installation automatisée par GPO par l'agent FusionInventory ****
ECHO **** A utiliser via une GPO ****
ECHO **********************************************************************
rem **** Suppression de l'ancien fichier texte
echo o|del /s C:\VersionFusionInventory.txt
rem **** Récupère la version de l'agent instalé
IF NOT EXIST "C:\VersionFusionInventory1.txt" goto creationfichier
IF EXIST "C:\VersionFusionInventory1.txt" goto recuperationversion
:creationfichier
echo 232 > "C:\VersionFusionInventory1.txt"
goto recuperationversion
:recuperationversion
enabledelayedexpansion setlocal
for /f "delims=" %%X in ('type C:\VersionFusionInventory1.txt') do (
set VERSIONINSTALEE=%%X
)
rem **** URL d'accès au serveur GLPI (Windows Server 2008R2)
set FISERVER=http://X.X.X.X/glpi/plugins
rem **** Indiquez ici le chemin d'accès complet au serveur vers l'exécutable de l'installation de l'agent
set INSTALLSERVER=\\serveurglpi\Partage
rem **** Verification de l'architecture 32 ou 64bits
:chemin
IF EXIST "%programfiles(x86)%" goto 64b
echo Système 32 bits détecté
set PROGFOLDER=%programfiles%
echo Dossier d'installation : %PROGFOLDER%\FusionInventory-Agent
goto suite
:64b
echo Système 64bits détecté
set PROGFOLDER=%programfiles(x86)%
echo Dossier d'installation : %PROGFOLDER%\FusionInventory-Agent
goto suite
:suite
IF EXIST "%PROGFOLDER%\FusionInventory-Agent\" goto test
IF NOT EXIST "%PROGFOLDER%\FusionInventory-Agent\" goto installation
:test
enabledelayedexpansion setlocal
for /f "delims=" %%X in ('type \\sgv-sv-glpi\Partage\VersionLaPlusRecente.txt') do (
set VERSIONLAPLUSRECENTE=%%X
)
echo %VERSIONLAPLUSRECENTE%
IF %VERSIONINSTALEE% GEQ %VERSIONLAPLUSRECENTE% goto end
IF %VERSIONINSTALEE% LSS %VERSIONLAPLUSRECENTE% goto upgrade
:upgrade
echo Upgrade requise
set N1=2
set N2=3
set N3=8
%INSTALLSERVER%\fusioninventory-agent_windows-x86_%N1%.%N2%.%N3%.exe /server="%FISERVER%/fusioninventory" /debug=1 /runnow /acceptlicense /S
IF NOT ERRORLEVEL 0 goto end
echo %VERSIONLAPLUSRECENTE% > "C:\VersionFusionInventory1.txt"
goto end
rem **** Etiquette d'installation de l'agent fusion inventory sur la machine cliente
:installation
echo Installation
%INSTALLSERVER%\fusioninventory-agent_windows-x86_2.3.2.exe /server="%FISERVER%/fusioninventory" /debug=1 /runnow /acceptlicense /S
IF NOT ERRORLEVEL 0 goto end
goto end
:end
ECHO INSTALLATION TERMINEE
pause
Partager