Jump to content

** Quickly Toggle Metro Apps On and Off **


DosProbie

Recommended Posts

If your getting the Metro Admin error message when attempting to launch a Metro app because you are the Built-in Administrator for Windows 8 like I am then you probably already know that the Metro Apps are disabled by default

to circumvent this I created a menu driven batch file that will enable metro when I want to use the apps then disable when I am not using, Of course you can also pin a shortcut to the desktop or taskbar with a Win8 icon for quicker access...Enjoy! DosProbie ö¿ö

echo off&color a && cls && Mode 62,11
pushd %~dp0%
title, [ TOGGLE METRO APPS ON/OFF ]
:: = NOTES =
:: THIS BATCH ONLY WORKS FOR THE BUILT-IN ADMINISTRATOR ACCOUNT!
:: Auto set the Admin Approval Mode via Command Prompt without messing with the Local Security Policy settings..
:: Fixes The Pop-up Nag ==>"This app can't be activated when UAC is disabled and/or by the Built-in Administrator."
:: Sets GPO Settings For Metro Apps (1=Enabled and 0=Disabled and UAC Setting to: 0=Never 5=Notify)
:: DOS_PROBIE. 02.25.13

:: • RUNS BATCH WITH "ELEVATED PERMISSIONS" AS THE BUILT-IN ADMINISTRATOR • (Prevents "ERROR: Access is denied.")
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

"%temp%\getadmin.vbs"
exit /B

:gotAdmin

if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
::<========== < BATCH SCRIPT > ==========>
:mainmenu
cls
echo.
echo.
echo [ MAIN MENU ]
echo +=====================+
echo A.) ENABLE Metro Apps
echo.
echo B.) DISABLE Metro Apps
echo.
echo C.) [EXIT] And Reboot
echo +=====================+
echo.
:select
set /p userinp= ^ Make your selection:
set userinp=%userinp:~0,1%
if /i "%userinp%"=="A" goto enable
if /i "%userinp%"=="B" goto disable
if /i "%userinp%"=="C" goto exit
echo.Invalid! Try Again...
echo.
goto select
:enable
cls
echo Press any [KEY] To Enable Metro...&pause>nul&goto :on
:on
cls
:: • ENABLE METRO FOR ADMIN(Runs as "Current User" with UAC Disabled) •
reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v EnableLUA /t reg_dword /d 1 /f>nul
reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v FilterAdministratorToken /t reg_dword /d 1 /f>nul
reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v ConsentPromptBehaviorAdmin /t reg_dword /d 0 /f>nul
reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v ConsentPromptBehaviorUser /t reg_dword /d 0 /f>nul
reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v PromptOnSecureDesktop /t reg_dword /d 0 /f>nul

echo.
cls
echo * ENABLED * == Press Any [KEY] To Return To The Main Menu ==&pause>nul&goto :mainmenu
::===========+
:disable
cls
echo Press any [KEY] To Disable Metro...&pause>nul&goto :off
:off
cls
:: • DISABLE METRO APPS(Return as "Built-In Admin" with UAC Disabled) •
reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v EnableLUA /t reg_dword /d 1 /f>nul
reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v FilterAdministratorToken /t reg_dword /d 0 /f>nul
reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v ConsentPromptBehaviorAdmin /t reg_dword /d 0 /f>nul
reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v ConsentPromptBehaviorUser /t reg_dword /d 0 /f>nul
reg add "hklm\software\microsoft\windows\currentversion\policies\system" /v PromptOnSecureDesktop /t reg_dword /d 0 /f>nul
echo.
cls
echo * DISABLED * == Press Any [KEY] To Return To The Main Menu ==&pause>nul&goto :mainmenu
::===========+
:: • EXIT AND REBOOT •
:exit
cls
set /p option=* EXIT * Press [ENTER] To Reboot For Changes..&shutdown.exe -f -r -t 0&cls&exit

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...