:::::::::::::::::::::::::::::::::::::::::::: :: Elevate.cmd - Version 4 :: Automatically check & get admin rights :::::::::::::::::::::::::::::::::::::::::::: @echo off CLS ECHO. color 0A :init setlocal DisableDelayedExpansion set cmdInvoke=1 set winSysFolder=System32 set "batchPath=%~0" for %%k in (%0) do set batchName=%%~nk set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs" setlocal EnableDelayedExpansion :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 ************** ECHO Invoking UAC for Privilege Escalation ECHO ************** ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%" ECHO args = "ELEV " >> "%vbsGetPrivileges%" ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%" ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%" ECHO Next >> "%vbsGetPrivileges%" if '%cmdInvoke%'=='1' goto InvokeCmd ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%" goto ExecElevation :InvokeCmd ECHO args = "/c """ + "!batchPath!" + """ " + args >> "%vbsGetPrivileges%" ECHO UAC.ShellExecute "%SystemRoot%\%winSysFolder%\cmd.exe", args, "", "runas", 1 >> "%vbsGetPrivileges%" :ExecElevation "%SystemRoot%\%winSysFolder%\WScript.exe" "%vbsGetPrivileges%" %* exit /B :gotPrivileges setlocal & cd /d %~dp0 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) ECHO ============================= ECHO Executanto como Administrador ECHO ============================= :::::::::::::::::::::::::::: ::START :::::::::::::::::::::::::::: set VPNName=VPN_PMM set VPNAddress=168.90.42.254 rem Crie a conexão VPN echo Criando conexão VPN... powershell.exe -Command "Add-VpnConnection -Name '%VPNName%' -ServerAddress '%VPNAddress%' -TunnelType L2tp -EncryptionLevel Optional -AuthenticationMethod MSChapv2 -RememberCredential -PassThru -AllUserConnection" echo Processo Concluido. echo Basta se conectar a vpn e informar o usuario e senha que sera solicitado no primeiro acesso echo Caso não tenha um usuario e senha entre em contato com o setor de T.I pause