MSFN Forum: ** Quickly Toggle Metro Apps On and Off ** - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

** Quickly Toggle Metro Apps On and Off ** Running Metro Apps as the Built-In Administrator

#1 User is online   DosProbie 

  • Member
  • Group: Supreme Sponsor
  • Posts: 202
  • Joined: 16-October 12
  • OS:Windows 8 x64
  • Country: Country Flag

Posted 26 February 2013 - 12:54 PM

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






Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy