Hi,
This one line vbscript calls a batch file to run silently. The batch file is opening a window. Can someone help.
vbcommand:
CreateObject("Wscript.Shell").Run "%TEMP%\AltirisCleanup\AAInstall.bat",0,True
batch:
If [%ERRORLEVEL%] == [0] (
echo X86
cd %systemroot%\system32
If exist "CleanupCompleted.txt" exit
call :CLEANUP
call :FILEMOVE1
) ELSE (
echo AMD64
cd %systemroot%\sysnative
If exist "CleanupCompleted.txt" exit
call :CLEANUP
call :FILEMOVE2
)
:CLEANUP
REM Get the Altiris Agent install path
FOR /F "tokens=2*" %%A IN ('REG.EXE QUERY "HKLM\Software\Altiris\Altiris Agent" /V "installdir"') DO SET AgentDir=%%B
set tempbat="%temp%\AgentClean.bat"
REM Create temporary batch file to execute while the agent restarts
(
echo "%AgentDir%\aexagentutil" /stop
echo rmdir "%AgentDir%\TaskManagement\cache" /s /q
echo rmdir "%AgentDir%\TaskManagement\status" /s /q
echo rmdir "%AgentDir%\TaskManagement\statusXml" /s /q
REM echo rmdir "%AgentDir%\TaskManagement\lti" /s /q
echo ping localhost -n 30
echo "%AgentDir%\aexagentutil" /start
echo exit /b
) > %tempbat%
REM Executes temporary batch file
start "" /MIN %tempbat%
Set RegVar=HKLM\Hardware\Description\System\CentralProcessor\0
REG.exe Query %RegVar% 2>NUL | find /I /N "x86">NUL
exit /b
:FILEMOVE1
COPY /Y "%~dp0\CleanupCompleted.txt" "%systemroot%\system32\CleanupCompleted.txt"
exit /b
:FILEMOVE2
%systemroot%\sysnative\cmd.exe /c copy /y "%~dp0\CleanupCompleted.txt" "%systemroot%\system32\CleanupCompleted.txt"
exit /b
I got the batch from a Symasntec website so not quite sure what could be wrong. In case your wondering how the text file gets copied out, I have the vb and batch in a WinRAR self extracting EXE. So the text file is extracted from there.
Thanks.
This one line vbscript calls a batch file to run silently. The batch file is opening a window. Can someone help.
vbcommand:
CreateObject("Wscript.Shell").Run "%TEMP%\AltirisCleanup\AAInstall.bat",0,True
batch:
If [%ERRORLEVEL%] == [0] (
echo X86
cd %systemroot%\system32
If exist "CleanupCompleted.txt" exit
call :CLEANUP
call :FILEMOVE1
) ELSE (
echo AMD64
cd %systemroot%\sysnative
If exist "CleanupCompleted.txt" exit
call :CLEANUP
call :FILEMOVE2
)
:CLEANUP
REM Get the Altiris Agent install path
FOR /F "tokens=2*" %%A IN ('REG.EXE QUERY "HKLM\Software\Altiris\Altiris Agent" /V "installdir"') DO SET AgentDir=%%B
set tempbat="%temp%\AgentClean.bat"
REM Create temporary batch file to execute while the agent restarts
(
echo "%AgentDir%\aexagentutil" /stop
echo rmdir "%AgentDir%\TaskManagement\cache" /s /q
echo rmdir "%AgentDir%\TaskManagement\status" /s /q
echo rmdir "%AgentDir%\TaskManagement\statusXml" /s /q
REM echo rmdir "%AgentDir%\TaskManagement\lti" /s /q
echo ping localhost -n 30
echo "%AgentDir%\aexagentutil" /start
echo exit /b
) > %tempbat%
REM Executes temporary batch file
start "" /MIN %tempbat%
Set RegVar=HKLM\Hardware\Description\System\CentralProcessor\0
REG.exe Query %RegVar% 2>NUL | find /I /N "x86">NUL
exit /b
:FILEMOVE1
COPY /Y "%~dp0\CleanupCompleted.txt" "%systemroot%\system32\CleanupCompleted.txt"
exit /b
:FILEMOVE2
%systemroot%\sysnative\cmd.exe /c copy /y "%~dp0\CleanupCompleted.txt" "%systemroot%\system32\CleanupCompleted.txt"
exit /b
I got the batch from a Symasntec website so not quite sure what could be wrong. In case your wondering how the text file gets copied out, I have the vb and batch in a WinRAR self extracting EXE. So the text file is extracted from there.
Thanks.