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

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
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
@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

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

Yes...either add in group by clause or remove from select statement

Cause:
A SELECT list cannot include both a group function, such as AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, and an individual column expression, unless the individual column expression is included in a GROUP BY clause.

Action: Drop either the group function or the individual column expression from the SELECT list or add a GROUP BY clause that includes all individual column expressions listed.
Random Solutions  
 
programming4us programming4us