diff --git a/tools/setuser-fullaccess.cmd b/tools/setuser-fullaccess.cmd new file mode 100644 index 0000000..1ab9586 --- /dev/null +++ b/tools/setuser-fullaccess.cmd @@ -0,0 +1,43 @@ +@echo off + +IF %1.==. GOTO USAGE + +if /I %1 == %SystemDrive% goto nosystemdrive +if /I %1 == %SystemDrive%\ goto nosystemdrive + +if NOT EXIST %1 ( + echo ERROR: file or directory not found! + exit /b +) + +echo setting permissions for Users on [ %1 ] to FULLA-ACCESS ... + +if EXIST %1\* ( + + echo *** DIRECTORY mode *** + takeown /F %1 /R /A /D Y 1>nul + icacls %1 /inheritance:r + icacls %1 /grant Administrators:F /t /c /l /q + icacls %1 /grant Users:F /t /c /l /q + +) else ( + + echo *** FILE mode *** + takeown /F %1 /A 1>nul + icacls %1 /inheritance:r + icacls %1 /grant Administrators:F /c /l /q + icacls %1 /grant Users:F /c /l /q + +) +echo. +GOTO END + +:nosystemdrive +echo ERROR: cannot use the SystemDrive! +GOTO END + +:USAGE +echo "usage: %0 " + +:END + diff --git a/tools/setuser-noaccess.cmd b/tools/setuser-noaccess.cmd new file mode 100644 index 0000000..410bd94 --- /dev/null +++ b/tools/setuser-noaccess.cmd @@ -0,0 +1,43 @@ +@echo off + +IF %1.==. GOTO USAGE + +if /I %1 == %SystemDrive% goto nosystemdrive +if /I %1 == %SystemDrive%\ goto nosystemdrive + +if NOT EXIST %1 ( + echo ERROR: file or directory not found! + exit /b +) + +echo removing access rights for Users on [ %1 ] ... + +if EXIST %1\* ( + + echo *** DIRECTORY mode *** + takeown /F %1 /R /A /D Y 1>nul + icacls %1 /inheritance:r + icacls %1 /grant Administrators:F /t /c /l /q + icacls %1 /remove Users /t /c /l /q + +) else ( + + echo *** FILE mode *** + takeown /F %1 /A 1>nul + icacls %1 /inheritance:r + icacls %1 /grant Administrators:F /c /l /q + icacls %1 /remove Users /c /l /q + +) +echo. +GOTO END + +:nosystemdrive +echo ERROR: cannot use the SystemDrive! +GOTO END + +:USAGE +echo "usage: %0 " + +:END +