select 'taskkill /s'||' '||SUBSTR(MACHINE,11)||' '||'/im Sm.Main.exe' from V$SESSION where USERNAME in
(select USERNAME from V$SESSION where AUDSID in
(select AUDSID from
(select MIN(AUDSID)AUDSID, USERNAME, MACHINE from V$SESSION where STATUS<>'KILLED' and PROGRAM = 'Sm.Main.exe' GROUP BY USERNAME,MACHINE))
and STATUS<>'KILLED'
and PREV_EXEC_START < sysdate-1/24)
GROUP BY MACHINE;