Jump to content

Setting file permissions.


Recommended Posts

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 by System238
Link to comment
Share on other sites

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...
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...