Closed aurelienjes closed 7 months ago
Hi @aurelienjes
what do you mean exactly by Agent was upgraded via tasks on GLPI.
? If you mean you're using the Deploy task to upgrade agent itself, maybe you're doing something wrong as the GLPI-Agent installer will have to stop the current service. So in that case, can you share the task full configuration ?
Hi and thanks for your answer @g-bougard
The upgrade via GLPI tasks seems to run like a charm. I've done like this for more than 300 devices without problem. This is the task configuration :
Command to start in the package : msiexec /i GLPI-Agent-1.7.1-x64.msi /quiet /norestart SERVER="https://myglpiserver.com/glpi/marketplace/glpiinventory/" ADD_FIREWALL_EXCEPTION=1 HTTPD_TRUST="127.0.0.1/32,myglpiserver" RUNNOW=1
I think we can do the upgrade with GLPI Tasks. The result of the task is Error because the agent is stopping during the upgrade but in fact, the agent is upgraded fine.
For the moment few devices have rebooted so I've scheduled one reboot on a device which have not rebooted since upgrade. And so, I will check if the file will be deleted. I will post the result as soon as possible.
PS : tell me if you need more information about the GLPI task.
IMHO, your script is wrong: don't expect this work as expected all the time. So I'm definitively not surprised you have issues.
When installing from the agent itself, the called agent will be shutdown by the new installer. If something goes wrong during installation, you will probably just loose your agent.
I've notice a point some time ago: the installation may fail if the MSI server service is busy. For example, this can happen if another installation is pending. I added a fix on the vbs file for that.
Can I suggest few things ?
SetupOptions
variable.install.bat
which will wait a given time before starting the vbs, something like this:
timeout /t 60 /nobreak >nul
%TEMP%\AgentInstall\glpi-agent-deployment.vbs
exit %ERRORLEVEL%
%TEMP%\AgentInstall
vbs
, the bat
and the installer in that temporary folder: You will have to also fix SetupLocation
and set it to the same temporary folderbat
in background:
start /min AgentInstall %TEMP%\AgentInstall\install.bat
Maybe you can also use schtasks to schedule the vbs run a few time later but I'm not an expert and I'm not sure what's the best options for it.
This way, the glpi task will still quickly finish and you won't have an error in GLPI. The real installation should start a minute later. You'll still have to create a task or adapt the bat to cleanup the temporary folder.
I'm definitively not a windows expert so I'm not sure this is the best way of doing, but the principle is here:
You can also update the vbs to wait 60 seconds adding WScript.Sleep 60000
at the beginning and directly start /min AgentInstall %TEMP%\AgentInstall\glpi-agent-deployment.vbs
in the actions without needing the install.bat
. That's up to you.
Hi @g-bougard ! Thanks a lot for your explanation.
I will try with vbs script and I will update this thread with the result of the test.
I didn't try the vbs yet but I can confirm that all my Windows GLPI Agent which I've updated with GLPI Task Deployment need the file "C:\Program Files\GLPI-Agent\perl\bin\glpi-win32-service" from another healthy device and then restart the agent.
So, I confirm that you can't upgrade Windows GLPI agent with msi package directly on Task Deployment (like describe on the start of this topic).
I will try @g-bougard 's script when a new update of the agent will be available and I will post the result here.
May I suggest a new feature for GLPI agent (because I didn't find it for the moment) ? If GLPI Agent could be upgraded directly from GLPI server, it will be a good thing.
Hi @aurelienjes
as I explained, without taking care of the execution context, you run the upgrade in a wrong way.
For this reason, I'm closing this issue as it is indeed invalid.
If you don't manage to upgrade the agent with my advises, eventually try to use a GPO if possible and as most people uses the vbs from a GPO.
Anyway, feel free to comment to report the results of your tries and even explain in details a working process if you manage to make it works.
Bug reporting acknowledgment
Yes, I read it
Professional support
Yes, I know
Describe the bug
On the first reboot after the upgrade from 1.6 to 1.7.1, glpi agents can't start because of file "glpi-win32-service" which is deleted.
Affected OS for now is Windows 2019 Datacenter et Windows 2012 R2 Datacenter. Agent was upgraded via tasks on GLPI.
I didn't find helpful events in Event Viewer at first glance.
To reproduce
Expected behavior
Normal start wihout behavior
Operating system
Windows
GLPI Agent version
1.7, 1.6.1, 1.6
GLPI version
10.0.12
GLPIInventory plugin or FusionInventory for GLPI plugin version
GLPI Inventory v1.3.4
Additional context
To bypass this problem, you need to copy this file "C:\Program Files\GLPI-Agent\perl\bin\glpi-win32-service" from another healthy device and paste it on the device where the file was deleted. Then restart the agent and all will run fine.