This task include one batch file that can find patches in client computer by remote. I build this batch file as package into ALtiris 7.5.
Now the issue is run batch file in my hard disk by manual, everything is fine. For example, will showed "PC1234, 3065822 Patch found". I checked PC1234 by remote, the 3065822 patch is installed.
However If I use job task and push this package to my computer (I want this task can automatic run in weekend), then will showed "PC1234, 3065822 Patch does not exist ".
This is code
@ECHO OFF
SETLOCAL
set LOGFILE_DATE=%DATE:~6,4%.%DATE:~3,2%.%DATE:~0,2%
set LOGFILE_TIME=%TIME:~0,2%.%TIME:~3,2%
set LOGFILE=log-%LOGFILE_DATE%-%LOGFILE_TIME%.txt
rem log-2014.05.17.txt
echo %date% : %time% > %LOGFILE%
set PATCH=3078071
for /f %%i in (workstations.txt) do (Call :CHECK %%i)
Goto End
:CHECK
Set COMPUTERNAME=%1
:PING
ping %COMPUTERNAME% -n 1 > .\temp\Ping.txt
find /I "out" .\temp\Ping.txt > .\temp\Reply.txt
if %errorlevel% == 0 Echo %COMPUTERNAME%, is Offline >> %LOGFILE% & Goto END
find /I "check" .\temp\Ping.txt > .\temp\Reply.txt
if %errorlevel% == 0 Echo %COMPUTERNAME%, Host is Not Found >> %LOGFILE% & Goto END
REM # Determine patch
:Search Pathch
wmic /node:%COMPUTERNAME% qfe | find /I "%PATCH%"
REM # IF ERRORLEVEL = 0 it is there
IF %ERRORLEVEL% == 0 (GOTO REPLACE_FILES2) ELSE (GOTO LOOP)
:REPLACE_FILES2
Echo %COMPUTERNAME%, %PATCH% Patch found >> %LOGFILE%
GOTO END
:LOOP
Echo %COMPUTERNAME%, %PATCH% Patch does not exist >> %LOGFILE%
:END
I think this code cause issue "wmic /node:%COMPUTERNAME% qfe | find /I "%PATCH%" "
However spent couple hours, can't fix this issues.
Please help me, thanks.