Administrative shares are hidden network shares that allow system administrators to have remote access to every disk volume on a network-connected system. These shares may not be permanently deleted but may be disabled. Windows users can use the net share command to view all of the shares (including the hidden shares) on your computer.
With this batch script disable or enable Administrative Hidden Shares.
With this batch script disable or enable Administrative Hidden Shares.
Code
@Echo Off & Cls
net sess>nul 2>&1||(powershell start cmd -ArgumentList """/c %~0""" -verb Runas & exit)
Cls & Mode CON LINES=11 COLS=80 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo Do You Want To Disable Administrative Hidden Shares (Y/N)?
Echo.
Echo.
Echo.
Set /p input= RESPONSE:
If /i Not %input%==Y (Goto :_Ex) Else (Goto :_Start)
:_Ex
If /i Not %input%==N (Goto :EOF) Else (Goto :_RegRestore)
:_Start
Reg Add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "AutoShareServer" /t REG_DWORD /d "0" /f > Nul
Reg Add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "AutoShareWks" /t REG_DWORD /d "0" /f > Nul
Cls & Mode CON LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo Administrative Hidden Shares Disabled
Echo.
Echo.
Echo.
ping -n 6 localhost >nul
CHOICE /C YN /M "Press Y to Reboot, N for exiting script."
If %errorlevel% == 1 ( Shutdown /r /t 0) Else (Exit)
:_RegRestore
Reg Query "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "AutoShareServer" > Nul
If %ErrorLevel% EQU 1 Goto :EOF
Reg Delete "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "AutoShareServer" /f > Nul
Reg Delete "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "AutoShareWks" /f > Nul
Cls & Mode CON LINES=11 COLS=60 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo Administrative Hidden Shares Enabled
Echo.
Echo.
Echo.
ping -n 6 localhost >nul
CHOICE /C YN /M "Press Y to Reboot, N for exiting script."
If %errorlevel% == 1 ( Shutdown /r /t 0) Else (Exit)
