
committed by
GitHub

2 changed files with 76 additions and 0 deletions
@ -0,0 +1,36 @@ |
|||
@echo off |
|||
SET DIR=%~dp0% |
|||
:Begin UAC check and Auto-Elevate Permissions |
|||
:------------------------------------- |
|||
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: |
|||
echo Requesting Administrative Privileges... |
|||
echo Press YES in UAC Prompt to Continue |
|||
echo: |
|||
|
|||
|
|||
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" |
|||
:-------------------------------------- |
|||
|
|||
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\install-basic-software.ps1'" |
|||
pause |
@ -0,0 +1,40 @@ |
|||
@echo off |
|||
SET DIR=%~dp0% |
|||
:Begin UAC check and Auto-Elevate Permissions |
|||
:------------------------------------- |
|||
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: |
|||
echo Requesting Administrative Privileges... |
|||
echo Press YES in UAC Prompt to Continue |
|||
echo: |
|||
|
|||
|
|||
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" |
|||
:-------------------------------------- |
|||
|
|||
echo Installing chocolatey. |
|||
|
|||
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin |
|||
|
|||
pause |
Loading…
Reference in new issue