(Apr 14, 2017 07:02 AM)Phlox Wrote: I think you are asking to remove security tab i think you can do this with a group policy.
Thank you for your answer
Phlox, but, how to remove the security tab with a batch script ?
EDIT :
I found a
hint here
To Disable Security tab:
Code
REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v Nosecuritytab /t REG_DWORD /d 1 /f
To Enable Security tab:
Code
REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v Nosecuritytab /t REG_DWORD /d 0 /f
Here is the new script :
ChangePermission.bat
Code
@echo off
Title Example of using the ICACLS command by Hackoo 2017
Mode con cols=70 lines=10 & color 0E
set "folder=%userprofile%\Desktop\TestHackoo"
If not exist "%folder%" MD "%folder%"
:Main
Cls
echo ==================================
echo Menu
echo ==================================
echo [1] CONTROL TOTAL
echo [2] READING ONLY
echo [3] WRITING ONLY
echo -----------------------------------
echo(
set /p "MyChoice=Please choose 1,2,3 : "
If "%MyChoice%" EQU "1" (
icacls "%folder%" /grant:r "%username%:(OI)(CI)F">nul 2>&1
icacls "%folder%" /inheritance:r
Call :Enable_Security_tab
If "%ErrorLevel%" EQU "0" (
cls & echo( & color 0A
echo "%folder%" HAVE A CONTROL TOTAL !
Timeout /T 1 /nobreak>nul
Explorer %folder% & Exit
) else (
cls & echo( & color 0
echo Command Failure !
)
)
If "%MyChoice%" EQU "2" (
icacls "%folder%" /grant:r "%username%:(OI)(CI)R">nul 2>&1
icacls "%folder%" /inheritance:r
Call :Disable_Security_tab
If "%ErrorLevel%" EQU "0" (
cls & echo( & color 0C
echo "%folder%" IS READING ONLY !
Timeout /T 1 /nobreak>nul
Explorer %folder% & Exit
) else (
cls & echo( & color 0C
echo Command Failure !
)
)
If "%MyChoice%" EQU "3" (
icacls "%folder%" /grant:r "%username%:(OI)(CI)W">nul 2>&1
icacls "%folder%" /inheritance:r
Call :Disable_Security_tab
If "%ErrorLevel%" EQU "0" (
cls & echo( & color 0C
echo "%folder%" IS WRITING ONLY !
Timeout /T 1 /nobreak>nul
Explorer %folder% & Exit
) else (
cls & echo( & color 0C
echo Command Failure !
)
)
::*********************************************************************************************************************
:Enable_Security_tab
REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v Nosecuritytab /t REG_DWORD /d 0 /f>nul 2>&1
exit /b
::*********************************************************************************************************************
:Disable_Security_tab
REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v Nosecuritytab /t REG_DWORD /d 1 /f>nul 2>&1
exit /b
::*********************************************************************************************************************