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.12.3 available

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

Script to install agent on Windows XP to Win 10

does anybody has a commandline script to install the agent on windows clients?

The script must be able to differentiate between 32 o 64 bit and XP to Windows 10 to install/upgrade the agent to the OS specific version.

For example Windows Agent 2.6 can't be installed on 32 bit Windows 10 OS.

2.6 also can't be installed on Windows XP

Kind regards
in OCS Inventory NG agent for Windows by (24.4k points)

4 Answers

0 votes

I used NSIS script to create a custom .exe and i do the checks before executing the agent setup.

https://nsis.sourceforge.io/Main_Page

If you don't succed in creating the NSIS script i can send you my script but you will have to customize it per your usage.

by (180 points)
edited by
0 votes
Hi Iulian, could I have your script please?
by (240 points)
0 votes
please have a look here

https://ask.ocsinventory-ng.org/12358/upgrading-2-4-x-agents-on-x64-systems

you can use parts of this script to detect windows versions

https://adamstech.wordpress.com/2009/07/16/use-a-batch-file-to-detect-windows-2k-xp-2003-vista-or-7/

but the upgrade installation didn't run error free for me and i used to create a special script which uses a task to uninstall the old version and reinstall the new one, because ocs inventory is usually in use and therefore an upgrade (through the ocs deplyoment) is not possible if the right "updgrade" parameters are not chosen or the agent itself has a bug.
The uninstall via a Taks runs but flawlessly.
I would have to search for the script (takes a long time)
by (24.4k points)
0 votes

If still needed, here our little dirty script ;-)

@echo off
set SERVER=\\yourserver\log\OCS
set CERTPATH=C:\ProgramData\OCS Inventory NG\Agent
set CERTNAME=cacert.pem
set OCSSERVERPATH=https://ocsinventory-ng.risse.local/ocsinventory
set OCSUSER=YOUROCSUSER
set OCSUSERPWD=YOURPASSWORD
set OCSSSL=1
set CLIENTNAME=%COMPUTERNAME%

@echo off
if exist "%windir%\SysWOW64" ( set "OSTyp=64bit" ) else ( set "OSTyp=32bit" )
Goto %OSTyp%
:64bit
set AGENT=OCS-Windows-Agent28-Setup-x64.exe
set LOG=OCS-NG-Agent28-64bit-%COMPUTERNAME%.log

Goto ALLE

:32bit
set AGENT=OCS-Windows-Agent28-Setup-x86.exe
set LOG=OCS-NG-Agent28-32bit-%COMPUTERNAME%.log
Goto ALLE

:ALLE
mkdir "%CERTPATH%"
mkdir %SERVER%\%CLIENTNAME%
rem copy %SERVER%\%AGENT% %SERVER%\%CLIENTNAME%\
copy %CERTNAME% "%CERTPATH%\%CERTNAME%"

%AGENT% /S /NOSPLASH /NOW /SERVER="%OCSSERVERPATH%" /USER=%OCSUSER% /PWD=%OCSUSERPWD% /SSL=%OCSSSL% /CA="%CERTNAME%"
echo . >> %SERVER%\%CLIENTNAME%\%LOG%
echo %CLIENTNAME% >> %SERVER%\%CLIENTNAME%\%LOG%
echo . >> %SERVER%\%CLIENTNAME%\%LOG%
move %SERVER%\%CLIENTNAME%\%LOG% %SERVER%\Erledigt\%CLIENTNAME%.log
rmdir %SERVER%\%CLIENTNAME% /S /Q

edit: May it is a display error at my site, in the %agent% line the end should be:
/CA="%CERTNAME%"

by (390 points)
 
Powered by Question2Answer
...