36 lignes
Pas d'EOL
1,2 Kio
Batchfile
36 lignes
Pas d'EOL
1,2 Kio
Batchfile
@echo off
|
|
echo Allow Windows explorer on Vista and up to use basic auth
|
|
echo.
|
|
echo.
|
|
echo.
|
|
|
|
:: UAC privilege escalation
|
|
:checkPrivileges
|
|
NET FILE 1>NUL 2>NUL
|
|
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
|
|
:getPrivileges
|
|
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
|
|
echo.
|
|
echo Invoking UAC for Privilege Escalation
|
|
setlocal DisableDelayedExpansion
|
|
set "batchPath=%~0"
|
|
setlocal EnableDelayedExpansion
|
|
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
|
|
echo args = "ELEV " >> "%temp%\OEgetPrivileges.vbs"
|
|
echo For Each strArg in WScript.Arguments >> "%temp%\OEgetPrivileges.vbs"
|
|
echo args = args ^& strArg ^& " " >> "%temp%\OEgetPrivileges.vbs"
|
|
echo Next >> "%temp%\OEgetPrivileges.vbs"
|
|
echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
|
|
"%SystemRoot%\System32\WScript.exe" "%temp%\OEgetPrivileges.vbs" %*
|
|
exit /B
|
|
:gotPrivileges
|
|
if '%1'=='ELEV' shift /1
|
|
setlocal & pushd .
|
|
cd /d %~dp0
|
|
:: /UAC privilege escalation
|
|
|
|
net stop webclient
|
|
reg add "HKLM\SYSTEM\CurrentControlSet\services\WebClient\Parameters" /f /v BasicAuthLevel /t REG_DWORD /d 2
|
|
net start webclient
|
|
echo Done, Have a nice Day.
|
|
pause |