Skip to content

Instantly share code, notes, and snippets.

@maciakl
Created July 1, 2022 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maciakl/686a1f9b6bcc1d7d33b88320c2a1e094 to your computer and use it in GitHub Desktop.
Save maciakl/686a1f9b6bcc1d7d33b88320c2a1e094 to your computer and use it in GitHub Desktop.
@echo off
if "%1" == "elevated" goto start
powershell -command "Start-Process %~nx0 elevated -Verb runas"
goto :eof
:start
@echo off
cls
echo.
echo.
echo StorageSense Helper
echo ===================
echo.
CALL :CHECK
echo.
choice /M "Enable, Disable, or Quit" /C EDQ
if %ERRORLEVEL% == 1 ( CALL :ENABLE )
if %ERRORLEVEL% == 2 ( CALL :DISABLE )
if %ERRORLEVEL% == 3 ( goto :eof )
goto :start
:DISABLE
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\StorageSense" /v AllowStorageSenseGlobal /t REG_DWORD /d 0 /f
echo.
goto :eof
:ENABLE
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\StorageSense" /v AllowStorageSenseGlobal /t REG_DWORD /d 1 /f
echo.
goto :eof
:CHECK
echo.
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\StorageSense" /v AllowStorageSenseGlobal
echo.
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment