OCSInventory-NG / Packager-for-Windows

The packager helps installing OCS Inventory NG Agent for Windows (or any windows application). It create an executable package including multiple files to install, and is able to run the installation process under the specified account having Administrative privileges.
Other
12 stars 7 forks source link

Wrong path on upgrade from 32bit to 64bit #11

Open ggzengel opened 3 years ago

ggzengel commented 3 years ago

It says it installs on upgrade to C:\Program Files\OCS Inventory Agent but the binaries are in C:\Program Files (x86)\OCS Inventory Agent. The plugins are in C:\Program Files\OCS Inventory Agent\Plugins

OCS Inventory NG Packager (Privilegied Installer) : Creating OCS Inventort NG Agent install directory <C:\Program Files\OCS Inventory Agent>...
OCS Inventory NG Packager (Privilegied Installer) : Creating OCS Inventort NG Agent Plugins directory <C:\Program Files\OCS Inventory Agent\Plugins>...
OCS Inventory NG Packager (Privilegied Installer) : Creating OCS Inventort NG Agent data directory <C:\ProgramData\OCS Inventory NG\Agent>...
OCS Inventory NG Packager (Privilegied Installer) : Installing OCS Inventort NG Agent data files to <C:\ProgramData\OCS Inventory NG\Agent>...
OCS Inventory NG Packager (Privilegied Installer) : Installing OCS Inventort NG Agent plugin files to <C:\Program Files\OCS Inventory Agent\Plugins>...
C:\>dir /S/B/A "C:\Program Files\OCS Inventory Agent"
C:\Program Files\OCS Inventory Agent\Plugins
C:\Program Files\OCS Inventory Agent\Plugins\DO_NOT_REMOVE.txt
C:\Program Files\OCS Inventory Agent\Plugins\msofficekey.vbs
C:\Program Files\OCS Inventory Agent\Plugins\osinstall.vbs

C:\>dir /S/B/A "C:\Program Files (x86)\OCS Inventory Agent"
C:\Program Files (x86)\OCS Inventory Agent\ComHTTP.dll
C:\Program Files (x86)\OCS Inventory Agent\Download.exe
C:\Program Files (x86)\OCS Inventory Agent\libcurl.dll
C:\Program Files (x86)\OCS Inventory Agent\libeay32.dll
C:\Program Files (x86)\OCS Inventory Agent\mfc120.dll
C:\Program Files (x86)\OCS Inventory Agent\mfc120u.dll
C:\Program Files (x86)\OCS Inventory Agent\mfc140.dll
C:\Program Files (x86)\OCS Inventory Agent\mfc140u.dll
C:\Program Files (x86)\OCS Inventory Agent\mfcm120.dll
C:\Program Files (x86)\OCS Inventory Agent\mfcm120u.dll
C:\Program Files (x86)\OCS Inventory Agent\mfcm140.dll
C:\Program Files (x86)\OCS Inventory Agent\mfcm140u.dll
C:\Program Files (x86)\OCS Inventory Agent\msvcp120.dll
C:\Program Files (x86)\OCS Inventory Agent\msvcp140.dll
C:\Program Files (x86)\OCS Inventory Agent\msvcr120.dll
C:\Program Files (x86)\OCS Inventory Agent\OCS-transform.xsl
C:\Program Files (x86)\OCS Inventory Agent\OCSInventory Front.dll
C:\Program Files (x86)\OCS Inventory Agent\OCSInventory.exe
C:\Program Files (x86)\OCS Inventory Agent\OcsNotifyUser.exe
C:\Program Files (x86)\OCS Inventory Agent\OcsService.exe
C:\Program Files (x86)\OCS Inventory Agent\OcsSnmp.exe
C:\Program Files (x86)\OCS Inventory Agent\OcsSystray.exe
C:\Program Files (x86)\OCS Inventory Agent\OcsWmi.dll
C:\Program Files (x86)\OCS Inventory Agent\Plugins
C:\Program Files (x86)\OCS Inventory Agent\ssleay32.dll
C:\Program Files (x86)\OCS Inventory Agent\SysInfo.dll
C:\Program Files (x86)\OCS Inventory Agent\ucrtbase.dll
C:\Program Files (x86)\OCS Inventory Agent\uninst.exe
C:\Program Files (x86)\OCS Inventory Agent\vcamp120.dll
C:\Program Files (x86)\OCS Inventory Agent\vcamp140.dll
C:\Program Files (x86)\OCS Inventory Agent\vcomp120.dll
C:\Program Files (x86)\OCS Inventory Agent\vcomp140.dll
C:\Program Files (x86)\OCS Inventory Agent\vcruntime140.dll
C:\Program Files (x86)\OCS Inventory Agent\vcruntime140_1.dll
C:\Program Files (x86)\OCS Inventory Agent\ZipArchive.dll
C:\Program Files (x86)\OCS Inventory Agent\zlib1.dll
C:\Program Files (x86)\OCS Inventory Agent\Plugins\DO_NOT_REMOVE.txt
C:\Program Files (x86)\OCS Inventory Agent\Plugins\Saas.ps1
ggzengel commented 3 years ago

I use: OCS-Windows-Agent-Setup-x64.exe /S /UPGRADE /NOSPLASH /NO_SYSTRAY /NOW /SSL=1 /SERVER=https://xxx/ocsinventory

Neustradamus commented 3 years ago

@gillesdubois: What do you think?

codiflow commented 1 year ago

Can confirm this behaviour. If you rely on extensions (what most likely everybody does) the OCSPackager for Windows can be seen as broken for updates because of this bug.

I will switch back to my "old" deployment strategy with a zip file and a batch file. I share it with you here as some kind of "workaround" as long as the bug is not getting fixed.

The zip file contains the following files:

agent.zip

├── 0_silent-install-script.cmd
├── AUTHORS.TXT
├── cacert.pem
├── CHANGELOG
├── DISCLAMER.TXT
├── EasyCopy_x64
│   ├── ProgramData
│   │   └── OCS Inventory NG
│   │       └── Agent
│   │           └── cacert.pem
│   └── Program Files (x86)
│       └── OCS Inventory Agent
│           └── Plugins
│               ├── driverslist.vbs
│               ├── listprinters.vbs
│               ├── ...
├── EasyCopy_x86
│   ├── ProgramData
│   │   └── OCS Inventory NG
│   │       └── Agent
│   │           └── cacert.pem
│   └── Program Files
│       └── OCS Inventory Agent
│           └── Plugins
│               ├── driverslist.vbs
│               ├── listprinters.vbs
│               ├── ...
├── LICENSE.TXT
├── OCS-Windows-Agent-Setup-x64.exe
├── OCS-Windows-Agent-Setup-x86.exe
├── OPTIONS.TXT
├── Plugins
│   ├── driverslist.vbs
│   ├── listprinters.vbs
│   ├── ...
└── README.TXT

0_silent-install-script.cmd

@ECHO OFF

cd /D "%~dp0"

set /p tag=Please enter TAG for OCS Inventory: 

:CheckOS
IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)

:64BIT
echo 64-bit OS...
xcopy /s/e /h /y EasyCopy_x64\*.* C:\
OCS-Windows-Agent-Setup-x64.exe /s /server=https://ocs.domain.de/ocsinventory /tag="%tag%" /ssl=1 /ca="cacert.pem" /now /nosplash
GOTO END

:32BIT
echo 32-bit OS...
xcopy /s/e /h /y EasyCopy_x86\*.* C:\
OCS-Windows-Agent-Setup-x86.exe /s /server=https://ocs.domain.de/ocsinventory /tag="%tag%" /ssl=1 /ca="cacert.pem" /now /nosplash
GOTO END

:END
echo Finished...
nguironnet commented 1 year ago

Yes, i confirm the bug if you have a 32bits agent, you upgrade to 32 or 64 bits agent, the plugin directory is in program files and the binary are in program files (x86) The plugins used are in folder C:\Program Files (x86)\OCS Inventory Agent\plugins

It's ok if it's a fresh install with 64bits version, the binary are in program files folder (not x86)

hend217 commented 1 year ago

I confirm the problem when upgrading from 32-bit to 64-bit.

One way to fix this is to do a "clean upgrade".

@echo off
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OCSInventory.exe" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OCS Inventory NG Agent" /f
nguironnet commented 1 year ago

With ocs agent running as system service, no way to remove hklm registry entry, not enough rights :-(