Take precautions so set-perms.bat and unset-perms.bat are not ran as TrustedInstaller
This commit is contained in:
parent
2e32dba026
commit
8d923b8d89
@ -1,6 +1,11 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0"
|
||||
if "%isTrustedInstaller%" == "1" (
|
||||
echo Do not run this script as TrustedInstaller, run it as Administrator.
|
||||
pause
|
||||
goto exit
|
||||
)
|
||||
echo Setting permissions...
|
||||
icacls "%cd%" /setowner Administrators /T /C /L /Q >nul
|
||||
icacls "%cd%" /reset /T /C /L /Q >nul
|
||||
@ -8,4 +13,5 @@ icacls "%cd%" /inheritance:e /T /C /L /Q >nul
|
||||
icacls "%cd%" /inheritance:r /C /L /Q >nul
|
||||
icacls "%cd%" /setowner Administrators /T /C /L /Q >nul
|
||||
icacls "%cd%" /grant Users:(OI)(CI)RX /grant Administrators:(OI)(CI)F /grant "NT SERVICE\TrustedInstaller":(OI)(CI)F /grant SYSTEM:(OI)(CI)F /T /C /L /Q >nul
|
||||
pause
|
||||
pause
|
||||
:exit
|
@ -18,6 +18,7 @@ if not "%~1" == "-ti-run" (
|
||||
)
|
||||
|
||||
endlocal & set "pyexe=%pyexe%"
|
||||
set "isTrustedInstaller=1"
|
||||
set "pyexe=%pyexe:"=%"
|
||||
set "path=%cd%\path;%path%"
|
||||
set "cmd=%*"
|
||||
|
@ -1,6 +1,11 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0"
|
||||
if "%isTrustedInstaller%" == "1" (
|
||||
echo Do not run this script as TrustedInstaller, run it as Administrator.
|
||||
pause
|
||||
goto exit
|
||||
)
|
||||
echo Setting permissions...
|
||||
icacls "%cd%" /reset /T /C /L /Q >nul
|
||||
pause
|
Loading…
Reference in New Issue
Block a user