@echo off
set ServerLoc=\\inm\Logs\Software_Wise
if not exist %ServerLoc% exit /b
if exist temp1.txt del temp1.txt
for /f "tokens=*" %%A in ('reg query "hklm\software\microsoft\windows\currentversion\uninstall" ^| find /i "currentversion\uninstall\"') do (
reg query "%%A" | find /i "parentkeyname">NUL
if errorlevel 1 (
reg query "%%A" | find /i "systemcomponent" | find /i "0x1">NUL
if errorlevel 1 (
for /f "tokens=2,*" %%B in ('reg query "%%A" ^| find /i " displayname"') do (
echo %%C>>temp1.txt
)
)
)
)
sort temp1.txt>temp2.txt
set LastLine=
for /f "tokens=*" %%A in (temp2.txt) do (
if not "%%A"=="!LastLine!" (
if exist "%ServerLoc%\%%A.txt" (
findstr /i /b /e "%COMPUTERNAME%" "%ServerLoc%\%%A.txt">NUL
if ERRORLEVEL 1 (
echo %COMPUTERNAME%>>"%ServerLoc%\%%A.txt"
)
) else (
echo %COMPUTERNAME%>>"%ServerLoc%\%%A.txt"
)
set LastLine=%%a
)
)
if exist temp1.txt del temp1.txt
if exist temp2.txt del temp2.txt
|