Advertisement
FreeBooter

Take_Ownership

Aug 19th, 2022
1,511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.45 KB | Fixit | 0 0
  1. @Echo Off
  2.  
  3. Color 1A
  4.  
  5. Cd %systemroot%\system32
  6.  
  7.  
  8.  
  9.  
  10. REM  --> Check for permissions
  11. Reg query "HKU\S-1-5-19\Environment"
  12. REM --> If error flag set, we do not have admin.
  13. if %errorlevel% NEQ 0 (
  14. ECHO                 **************************************
  15. ECHO                  Running Admin shell... Please wait...
  16. ECHO                 **************************************
  17.  
  18.     goto UACPrompt
  19. ) else ( goto gotAdmin )
  20.  
  21. :UACPrompt
  22.     echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
  23.     set params = "%*:"=""
  24.     echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
  25.  
  26.     "%temp%\getadmin.vbs"
  27.     del "%temp%\getadmin.vbs"
  28.     exit /B
  29.  
  30.  
  31. :gotAdmin
  32.  
  33. Cls & Mode CON  LINES=11 COLS=104 & Color 0D & Title Created By FreeBooter
  34. Echo.
  35. Echo.
  36. Echo.
  37. Echo       ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  38. Echo       º Do You Want To Add Take Ownership to the Right-Click Menu in Windows Explorer (Y/N)?  º  
  39. Echo       ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  40. Echo.
  41. Echo.
  42.  
  43.  
  44. Set /p input= RESPONSE:
  45.  
  46. If /i  Not %input%==Y (Goto :_Ex) Else (Goto :_Start)
  47.  
  48. :_Ex
  49. If /i Not %input%==N  (Goto :EOF) Else (Goto :_RegRestore)
  50.  
  51.  
  52.  
  53. :_Start
  54.  
  55. Reg.exe add "HKCR\*\shell\runas" /ve /t REG_SZ /d "Take Ownership" /f > Nul
  56. Reg.exe add "HKCR\*\shell\runas" /v "NoWorkingDirectory" /t REG_SZ /d "" /f > Nul
  57. Reg.exe add "HKCR\*\shell\runas\command" /ve /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" && icacls \"%%1\" /grant administrators:F" /f > Nul
  58. Reg.exe add "HKCR\*\shell\runas\command" /v "IsolatedCommand" /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" && icacls \"%%1\" /grant administrators:F" /f > Nul
  59. Reg.exe add "HKCR\Directory\shell\runas" /ve /t REG_SZ /d "Take Ownership" /f > Nul
  60. Reg.exe add "HKCR\Directory\shell\runas" /v "NoWorkingDirectory" /t REG_SZ /d "" /f > Nul
  61. Reg.exe add "HKCR\Directory\shell\runas\command" /ve /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" /r /d y && icacls \"%%1\" /grant administrators:F /t" /f > Nul
  62. Reg.exe add "HKCR\Directory\shell\runas\command" /v "IsolatedCommand" /t REG_SZ /d "cmd.exe /c takeown /f \"%%1\" /r /d y && icacls \"%%1\" /grant administrators:F /t" /f > Nul
  63.  
  64.  
  65. Cls & Mode CON  LINES=11 COLS=60 & Color 0D & Title Created By FreeBooter
  66. Echo.
  67. Echo.
  68. Echo.
  69. Echo       ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  70. Echo       º  Take Ownership Context Menu Enabled º  
  71. Echo       ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  72. Echo.
  73. Echo.
  74.  
  75. Taskkill /im Explorer.exe /f >Nul
  76.  
  77. Start Explorer.exe
  78.  
  79. ping -n 6 localhost >Nul
  80. Exit
  81.  
  82.  
  83. :_RegRestore
  84.  
  85.  
  86. Reg.exe delete "HKCR\*\shell\runas" /f > Nul
  87. Reg.exe delete "HKCR\Directory\shell\runas" /f > Nul
  88.  
  89.  
  90. Cls & Mode CON  LINES=11 COLS=60 & Color 0D & Title Created By FreeBooter
  91. Echo.
  92. Echo.
  93. Echo.
  94. Echo       ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  95. Echo       º Take Ownership Context Menu Disabled  º  
  96. Echo       ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  97. Echo.
  98. Echo.
  99.  
  100. Taskkill /im Explorer.exe /f >Nul
  101.  
  102. Start Explorer.exe
  103.  
  104. ping -n 6 localhost >nul
  105. Exit
  106.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement