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.

How to update the Windows Agent correctly?

Hi, i have this situation

Server version 2.11.1

User agent :OCS-NG_WINDOWS_AGENT_v2.9.2.0

and i want to upgrade the agent software but i can't find an official tutorial. On issue page on github there is a open issue for the downloader that remain on older version.

Someone have some instruction?

Thanks
in OCS Inventory NG agent for Windows by (200 points)

6 Answers

0 votes
You have informations on documentation with some ways to install : GPO, Packager, .exe plus script ...

You have indication about Packager which is NOT designed for upgrade ...

The .exe (and script) had a switch '/upgrade'  well designed for this usage ...

(A VERY BAD way is to remove and install new agent due the risk of change deviceid !!)
by (20.1k points)
0 votes
The exe script no longer has the option '/upgrade'
by (200 points)
0 votes
NO, I write my own script WITH /upgrade ...

(There is NO standard script, you need to create your own script !)
by (20.1k points)
0 votes
sorry i don't understand if you write you own script why you use the option '/upgrade'?

I think that the upgrade of the agent must be simple and well documented
by (200 points)
0 votes
I explain the problem of upgrading in older thread ... (you could find it easily)

You don't understand there is a problem of (windows) service when you upgrade changing the .exe file providing service, so that is the reason of switch '/upgrade'.

Write your own scripts of installation and/or upgrade is an efficiant way when managing hundreds of PC ...
by (20.1k points)
0 votes

launch with pstools

PsExec.exe \\[PC] -c -f -s C:\Scripts\ocs-agent-update\install.bat

Install.bat :


powershell -executionpolicy bypass -noprofile -command "&{ \\servershare\OCS_Inventory\install.ps1}"

powershell script : install.ps1


#your cert file
$sourceFichier = "\\servershare\OCS_Inventory\cacert.pem"
$destFichier = "C:\ProgramData\OCS Inventory NG\Agent\"

    
    if((Test-Path -Path "C:\Program Files\OCS Inventory Agent\Download.exe"))
    {
        $VersionDownloadFile = (Get-Command "C:\Program Files\OCS Inventory Agent\Download.exe").Version
       
        #check version of download.exe
        if ($VersionDownloadFile -ne "2.9.2.0") # wrong version
        {
            write-Host "Wrong Version detected ! : Version=$VersionDownloadFile -> Update needed !"
            write-Host "uninstall in progress..."
            Start-Process -Wait "C:\Program Files\OCS Inventory Agent\uninst.exe" /S
            write-Host "commande : \\servershare\OCS_Inventory\setup.exe /S /CA=cacert.pem /SERVER=https://ocsinventory.local/ocsinventory"
            Start-Process -Wait -FilePath "\\servershare\OCS_Inventory\setup.exe" -ArgumentList "/S", "/CA=cacert.pem", "/SERVER=https://ocsinventory.local/ocsinventory"
            write-Host "copy file \\servershare\OCS_Inventory\cacert.pem to C:\ProgramData\OCS Inventory NG\Agent\"
            Copy-Item -Path $sourceFichier -Destination $destFichier -force
            write-Host "reboot needed !"
            #check version of download.exe
            $VersionDownloadFile = (Get-Command "C:\Program Files\OCS Inventory Agent\Download.exe").Version
            if($VersionDownloadFile -eq "2.9.2.0")
            {
                write-Host "Update successfull ! start services...."
                Start-Process -Wait "C:\Program Files\OCS Inventory Agent\OcsService.exe"
                write-Host "Start Systray"
                Start-Process "C:\Program Files\OCS Inventory Agent\OcsSystray.exe"
                write-Host "launch inventory"
                Start-Process "C:\Program Files\OCS Inventory Agent\OCSInventory.exe" -ArgumentList "/NOW"
                write-Host "exit 0"
                exit 0
            }
            else
            {
                write-Host "ERROR : exit 1"
                exit 1
            }
           
        }
        else  # good version
        {
            Start-Process "C:\Program Files\OCS Inventory Agent\OCSInventory.exe" -ArgumentList "/NOW"
            write-Host "Good version : $VersionDownloadFile "
            write-Host "exit 0"
            exit 0
        }
    }
    else
    {
        #agent not present reinstall it
        write-Host "error download.exe not exist ! reinstall needed"
        write-Host "commande : \\servershare\OCS_Inventory\setup.exe /S /CA=cacert.pem /SERVER=https://ocsinventory.local/ocsinventory"
        Start-Process -Wait -FilePath "\\servershare\OCS_Inventory\setup.exe" -ArgumentList "/S", "/CA=cacert.pem", "/SERVER=https://ocsinventory.local/ocsinventory"
        write-Host "copy file \\servershare\OCS_Inventory\cacert.pem to C:\ProgramData\OCS Inventory NG\Agent\"
        Copy-Item -Path $sourceFichier -Destination $destFichier -force
        write-Host "reboot needed !"
        #check version of download.exe
        $VersionDownloadFile = (Get-Command "C:\Program Files\OCS Inventory Agent\Download.exe").Version
        if($VersionDownloadFile -eq "2.9.2.0")
        {
            write-Host "Update successfull ! start services...."
            Start-Process -Wait "C:\Program Files\OCS Inventory Agent\OcsService.exe"
            write-Host "Start Systray"
            Start-Process "C:\Program Files\OCS Inventory Agent\OcsSystray.exe"
            write-Host "launch inventory"
            Start-Process "C:\Program Files\OCS Inventory Agent\OCSInventory.exe" -ArgumentList "/NOW"
            write-Host "exit 0"
            exit 0
        }
        else
        {
            write-Host "ERROR : exit 1"
            exit 1
        }
    }
 

by (660 points)
 
Powered by Question2Answer
...