I am trying to finish a script that will run through GPO that will detect if the KACE agent is installed and which version is installed. I have run into a snag and my script seems to be failing. Any help would be greatly appreciated. 


REM Setting default variables

SETLOCAL enabledelayedexpansion

SET SW32=%systemdrive%\Temp\KACE

SET LOG=%SW32%\ampagent_%computername%.log


SET MSI=ampagent-5.5.25198-x86.msi

SET FINDER=C:\Windows\System32\find.exe




REM Setting agent variables



IF EXIST %KACE_XML_55% ((ECHO %DATE% %TIME% - Agent already installed, checking version...>>%LOG% & CALL :CHKINST)

ELSE ECHO %DATE% %TIME% - Agent not installed. Calling Installer...>>%LOG% & CALL :INSTALL



REM Checks if and which agent(s) is installed

FOR /f "tokens=3 delims=><  " %%a IN ('TYPE C:\ProgramData\Dell\KACE\inventory.xml ^| FIND "<CLIENT_VERSION>"') DO SET AgentVersion=%%a


IF %AgentVersion% EQU 5.5.25198 (SET AgentOK=1 & ECHO %DATE% %TIME% - KACE Agent Version 5.5 found.>>%LOG%)


IF %AgentOK% EQU 0 (ECHO %DATE% %TIME% - KACE Agent needs to be updated. Calling Installer...>>%LOG% & CALL :INSTALL)





ECHO %DATE% %TIME% - Installing v5.5...>>%LOG%

IF NOT EXIST %SW32% (ECHO %DATE% %TIME% - Creating "%SW32%"...>>%LOG% & MKDIR %SW32%)

IF NOT EXIST %SW32%\%MSI% (ECHO %DATE% %TIME% - Copying "%SW32%\%MSI%"...>>%LOG% & CALL :MOUNT & COPY W:\%MSI% %SW32%\%MSI%)

start /wait msiexec.exe /qn /i %SW32%\%MSI% HOST=kace1200

ECHO %DATE% %TIME% - v5.5 Agent install complete.>>%LOG%


ECHO Pausing for 1 minute & ping -n 60 >null

NET USE W: /delete





ECHO %DATE% %TIME% - Mounting W:\ drive...>>%LOG%

IF EXIST W: ( ECHO %DATE% %TIME% - W:\ drive in use. Exiting...>>%LOG% & GOTO :EOF )

NET USE W: \\corp.mycompany.com\netlogon\util\KACE

IF NOT EXIST W: ( ECHO %DATE% %TIME% - W:\ drive failed to mount. Exiting.>>%LOG% & GOTO :EOF 



0 Comments   [ + ] Show Comments


Please log in to comment

Community Chosen Answer


Can you not just enable automatic updates for the agent? You can also run a report for what versions your machines currently have.

Answered 12/01/2013 by: dugullett
Red Belt

  • We have automatic updates currently enabled. The reason for the script is to re-install the agent in the case that people remove it on their own. I cant just blanket install on every machine which is why I am trying to write the logic into the script to determine if the agent is already installed and if it is the current version or not.
Please log in to comment



You can also use an Autoit Script or something else to read out 
the productversion of runkbot.exe

Answered 12/02/2013 by: aragorn.2003
Red Belt

Please log in to comment

Since it's an msi installer, wouldn't it be easier just to check its registry footprint?

I'm thinking HKLM\SOFTWARE\Microsoft\Windows\Currentversion\Uninstall\<your productcode>\DisplayVersion or something similar


or even simpler, just run it and catch a 1638 exit code (indicating another version is already installed)

Answered 12/05/2013 by: pjgeutjens
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity