Skitty 49 Posted March 2, 2011 (edited) I have this script I made to enable my script to install procexp.exe in place of taskmgr.exe @SystemDir and I want to know how I could set the rights back to the new file after replacing it. Func _TAKEOWN($File) If StringInStr($File, " ") Then $I1 = 0 while 1 If $I1 >= 3 Then ExitLoop RunWait('TAKEOWN /F "' & $File & '"',"",@SW_HIDE) Sleep(2000) run('icacls "' & $File & '" /grant *S-1-1-0:(F,WDAC)',"",@SW_SHOW) $I1 += 1 WEnd Else $I2 = 0 While 1 If $I2 >= 3 Then ExitLoop RunWait('TAKEOWN /F ' & $File,"",@SW_HIDE) Sleep(2000) run('icacls ' & $File & ' /grant *S-1-1-0:(F,WDAC)',"",@SW_SHOW) $I2 += 1 WEnd EndIf FileSetAttrib($File,"-RSH") EndFunc Edited March 2, 2011 by System238 Share this post Link to post Share on other sites
Skitty 49 Posted March 2, 2011 I have this script I made to enable my script to install procexp.exe in place of taskmgr.exe @SystemDir and I want to know how I could set the rights back to the new file after replacing it. Func _TAKEOWN($File) If StringInStr($File, " ") Then $I1 = 0 while 1 If $I1 >= 3 Then ExitLoop RunWait('TAKEOWN /F "' & $File & '"',"",@SW_HIDE) Sleep(2000) run('icacls "' & $File & '" /grant *S-1-1-0:(F,WDAC)',"",@SW_SHOW) $I1 += 1 WEnd Else $I2 = 0 While 1 If $I2 >= 3 Then ExitLoop RunWait('TAKEOWN /F ' & $File,"",@SW_HIDE) Sleep(2000) run('icacls ' & $File & ' /grant *S-1-1-0:(F,WDAC)',"",@SW_SHOW) $I2 += 1 WEnd EndIf FileSetAttrib($File,"-RSH") EndFunc Well, this is dumb... I just found out that there is an option in options to replace the task manager... Share this post Link to post Share on other sites
rudi 32 Posted March 2, 2011 Hi. Well, this is dumb... I just found out that there is an option in options to replace the task manager... In case you should want to roll out this replacement, this is the value you need (beside pushing procexp.exe to %windir%): Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskmgr.exe] "Debugger"="\"C:\\WINDOWS\\PROCEXP.EXE\"" Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Share this post Link to post Share on other sites