Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Change this Logon script to quer a txt file with machine names and do the same task.

Avatar of bsharath
bsharathFlag for India asked on
Programming Languages-OtherScripting LanguagesWindows Batch
11 Comments1 Solution398 ViewsLast Modified:
Hi,

Change this Logon script to quer a txt file with machine names and do the same task.
The script gets all softwares are there in the machines into seperate txt files each for each software name and the machine name into it.

Regards
sharath
@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
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
QlemoFlag of Germany image"Batchelor", Developer and EE Topic Advisor
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answers