30 April 2009

Information about TrendMicro

Recently, I've created a script to get information about server / workstation. This script writes all information (about hardware, software, settings,...) into XML file. I'd like to show up a part of this script. Create a text file and call it TrendMicroInfo.bat. Put the following lines (copy / past) into the TrendMicroInfo.bat:


@echo off
MD %SystemDrive%\INVENTORY\%COMPUTERNAME% > NULL 2>&1

For /f "Skip=1 Tokens=*" %%a in ('@ping -n 1 %computername%') do set line=%%a&call :ipa
endlocal&set $ip1=%$ip1%&set $ip2=%$ip2%&set $ip3=%$ip3%&set $ip4=%$ip4%
goto :EOF
:ipa
if /i not "%line:~0,7%"=="Pinging" goto :EOF
for /f "Tokens=2 Delims=[]" %%b in ('@echo %line%') do set ip=%%b
for /f "Tokens=1-4 Delims=." %%a in ('@echo %ip%') do set $ip1=%%a&set $ip2=%%b&set $ip3=%%c&set $ip4=%%d

set myip=%$ip1%.%$ip2%.%$ip3%.%$ip4%
echo Checking Local System with IP: %myip%
@ECHO.
@Echo Please wait....
@Echo.

SET RCOMP=%myip%
SET STOREPATH=%SystemDrive%\INVENTORY\%COMPUTERNAME%

SET UP_FROM_SRV=
SET Program_Version=
SET Engine_Version=
SET PatternDate=
SET Damage_Cleanup_Engine=

@echo ^ > %STOREPATH%\%RCOMP%_TrendMicroInfo.xml
@echo ^^en^ >> %STOREPATH%\%RCOMP%_TrendMicroInfo.xml
@echo ^%RCOMP%^ >> %STOREPATH%\%RCOMP%_TrendMicroInfo.xml

For /F "Tokens=3 Delims= " %%a in ('"REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion" /v Server | FIND /I "REG_SZ""') Do SET UP_FROM_SRV=%%a
For /F "Tokens=3 Delims= " %%a in ('"REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc." /v ProgramVer | FIND /I "REG_SZ""') Do SET Program_Version=%%a
For /F "Tokens=3 Delims= " %%a in ('"REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc." /v EngineZipVer | FIND /I "REG_SZ""') Do SET Engine_Version=%%a
For /F "Tokens=3 Delims= " %%a in ('"REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc." /v PatternDate | FIND /I "REG_SZ""') Do SET PatternDate=%%a
For /F "Tokens=3 Delims= " %%a in ('"REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc." /v TSC-Ver | FIND /I "REG_SZ""') Do SET Damage_Cleanup_Engine=%%a

REM .......... TrendMicro ..........
@echo ^^TrendMicro^ >> %STOREPATH%\%RCOMP%_TrendMicroInfo.xml
@echo ^^%UP_FROM_SRV%^^%Program_Version%^^%Engine_Version%^^%PatternDate%^^%Damage_Cleanup_Engine%^^ >> %STOREPATH%\%RCOMP%_TrendMicroInfo.xml
@echo ^
>> %STOREPATH%\%RCOMP%_TrendMicroInfo.xml
REM .......... TrendMicro ..........

@echo ^
>> %STOREPATH%\%RCOMP%_TrendMicroInfo.xml



Now, when you execute TrendMicroInfo.bat, on a system drive (generally it's drive "C") will be created folder INVENTORY. Inside this folder you will find a folder according to the Computer Name and inside this folder should be a file, named accordingly to the "IP_Address"_TrendMicroinfo.xml

Follow ITstuff.ca on Twitter

If you enjoyed this post consider subscribing via rssrectangle ITStuff.ca | Tips and Tricks for IT Staff or ITStuff.ca | Tips and Tricks for IT Staff Email


Bookmark and Share ITStuff.ca

No comments:

Post a Comment