ZCM Client Updater

ZCM Client Updater

A utility (CMD script) combined with the WGET utility, to download and install the latest available ZCM Client from your primary ZENworks server.

I am using this to manually upgrade ZCM 10.x / 11.x to 11.2.3a.

The script downloads files to the workstation into the directory "%TEMP%\ZENRRWEB\".

When launched, the script prompts the User with a menu to select what to download and install.

After a selection is made, the script downloads the selected stand-alone installer from the primary














Selection Download
Full ZCM Client PreAgentPkg_AgentComplete.exe
Inventory Only Module (IOM) ZENworks_Adaptive_Agent_Windows.exe

. . .


The script detects the architecture of the OS and obtains the correct installer. (Windows 32 or 64 Bit only).

Once the download has been verified, the existing client is removed, Full Client or the IOM.

After the removal has finished, the installer then begins.

If installing the Full Client, the script will terminate BEFORE the client installer's process completes.

In this case, the script notifies the user that the installer will prompt when it has completed.

Pressing a key at this point will cause the CMD Window to close.



This is what should be displayed once the Full Client installer is complete.



After rebooting, you will need to manually register the computer to the correct registration key. Since this script is for general use, the machines will register using the default key.

If installing the IOM, the script terminates AFTER the installer is completed.

Note the "Done! Reboot and Test . . ." notification.



If you want it to register automatically to a specific key, search for the line in the script that launches the Full Client installer:

start "" /b /wait "%TEMP%\PreAgentPkg_AgentComplete.exe" "-x"


and modify it to look like this, using your preferred key:

start "" /b /wait "%TEMP%\PreAgentPkg_AgentComplete.exe" "-x -k XXX"


A couple of things you must do if you use this script:

Modify the environment variables defined at the top of the script to contain valid values

Update these:


set __DLHOST=ZEN_DOWNLOAD_HOST_NAME
set __USER=ZEN_ADMIN_NAME
set __PASS=ZEN_ADMIN_PASS


Download WGET and put it in the same directory that you will place the script. The one I am using, I got from here: https://osspack32.googlecode.com/files/wget-1.14.exe.

There is nothing to configure related to the IOM installer.

Copy and paste the contents of this box to a .cmd or .bat file and perform the above mentioned customization.


@echo off
REM Ed Radke
REM Developed under ZCM 10/11
REM If vars are not already defined, define them here.
set __DLHOST=ZEN_DOWNLOAD_HOST_NAME
set __USER=ZEN_ADMIN_NAME
set __PASS=ZEN_ADMIN_PASS
REM Where is WGET.EXE
REM I got it here: https://osspack32.googlecode.com/files/wget-1.14.exe
REM currently defined as being in the same directory as the script.
set __WGET=%~dp0wget-1.14.exe
:MENU
cls
echo This script downloads and installs the latest available ZCM Client.
echo.
echo If a ZCM Client is already installed,
echo a normal un-installation occurs prior to this install.
echo Select:
echo.
echo 1 Install Full ZCM Client
echo 2 Install Inventory only module (IOM)
echo.
set /p __SELECT=^>^>^>:
if "%__SELECT%"=="1" call :FULL
if "%__SELECT%"=="2" call :IOM
if not defined __SUCCESS (
echo ABORT!
echo An invalid selection was made or,
echo the download has failed. Nothing has been changed.
pause
goto :EOF
)
echo.
echo Download was successful, Un-installing ZCM if it exists.
REM Uninstall Zenworks
set __ZENHOME=%ZENWORKS_HOME%
"%ZENWORKS_HOME%\bin\zac.exe" unr -u %__USER% -p %__PASS% > NUL 2>&1
"%ZENWORKS_HOME%\bin\ZENworksUninstall.exe" --local-only --remove-auth --quiet > NUL 2>&1
REM Attempt to remove any remaining components, this will also remove the IOM
call :MSI_REMOVE zenworks >NUL 2>&1
call :MSI_REMOVE casa >NUL 2>&1
rmdir /s /q "%__ZENHOME%" >NUL 2>&1
rmdir /s /q "%__ZENHOME%\..\CASA" >NUL 2>&1

REM Install Zenworks
echo.
echo Installing Selection . . .
if "%__SELECT%"=="1" (
start "" /b /wait "%TEMP%\PreAgentPkg_AgentComplete.exe" "-x"
echo The installer will prompt when it has completed . . .
)
if "%__SELECT%"=="2" (
start "" /b /wait "%TEMP%\ZENworks_Adaptive_Agent_Windows.exe" "-S"
echo Done! Reboot and Test . . .
)
pause
goto :EOF

:MSI_REMOVE
REM wmic product where (name like "%Zenworks%") get name,packagecache /format:csv
REM A string that will be searched for in the product name to be uninstalled, BE CAUTIOUS WHAT YOU TYPE HERE
if "%1"=="" goto :EOF
set __FILTER=%*
REM Output of wmic
set __OUT=%TEMP%\WMI.TXT
REM
REM Remove output if it exists
if exist "%__OUT%" del /f /q "%__OUT%" >NUL 2>&1
echo Initializing
REM search for MSI product's local package
wmic /output:"%__OUT%" product where (name like "%%%__FILTER%%%") get name,packagecache /format:csv
REM Convert output to ANSI
type "%__OUT%" >"%__OUT%.tmp"
type "%__OUT%.tmp" >"%__OUT%"
echo.
for /f "usebackq tokens=2,3 skip=2 delims=," %%A in ("%__OUT%") do (
echo Un-installing "%%A"
msiexec.exe /qn /x "%%B"
)
goto :EOF
:IOM
if exist "%TEMP%\ZENworks_Adaptive_Agent_Windows.exe" del /f "%TEMP%\ZENworks_Adaptive_Agent_Windows.exe">NUL 2>&1
"%__WGET%" -P "%TEMP%" --no-check-certificate %__DLHOST%/zenworks-downloads/inventory/Windows/ZENworks_Adaptive_Agent_Windows.exe
if exist "%TEMP%\ZENworks_Adaptive_Agent_Windows.exe" set __SUCCESS=1
goto :EOF

:FULL
if exist "%TEMP%\PreAgentPkg_AgentComplete.exe" del /f "%TEMP%\PreAgentPkg_AgentComplete.exe">NUL 2>&1
if /i "%PROCESSOR_ARCHITECTURE%"=="x86" (
"%__WGET%" -P "%TEMP%" --no-check-certificate %__DLHOST%/zenworks-downloads/setup/x86/PreAgentPkg_AgentComplete.exe
)
if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
"%__WGET%" -P "%TEMP%" --no-check-certificate %__DLHOST%/zenworks-downloads/setup/x86_64/PreAgentPkg_AgentComplete.exe
)
if exist "%TEMP%\PreAgentPkg_AgentComplete.exe" set __SUCCESS=1
goto :EOF


By the way, this script utilized the code I wrote for my published "(GroupWise) uninstall script" Tool
Labels (1)
Tags (2)

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
5 of 5
Last update:
Tuesday
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.