The script no longer requires admin rights
If it is running with admin rights, it will add the Wi-Fi profile for all users.
This commit is contained in:
parent
80b52c5cfe
commit
e194e54c32
1 changed files with 17 additions and 18 deletions
|
@ -1,27 +1,22 @@
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
set mypath=%~dp0
|
set mypath=%~dp0
|
||||||
|
set rights_admin=0
|
||||||
|
|
||||||
:: Check admin rights
|
:: Check admin rights
|
||||||
|
|
||||||
NET SESSION >nul 2>&1
|
NET SESSION >nul 2>&1
|
||||||
|
|
||||||
IF NOT %ERRORLEVEL% EQU 0 (
|
IF NOT %ERRORLEVEL% EQU 0 (
|
||||||
echo ######## ######## ######## ####### ########
|
echo ####### Running as a regular user #########
|
||||||
echo ## ## ## ## ## ## ## ## ##
|
echo # The Wi-Fi profiles will be installed #
|
||||||
echo ## ## ## ## ## ## ## ## ##
|
echo # for the current user. #
|
||||||
echo ###### ######## ######## ## ## ########
|
echo # Run as administrator to install them #
|
||||||
echo ## ## ## ## ## ## ## ## ##
|
echo # for all users. #
|
||||||
echo ## ## ## ## ## ## ## ## ##
|
echo ###########################################
|
||||||
echo ######## ## ## ## ## ####### ## ##
|
|
||||||
echo.
|
echo.
|
||||||
echo.
|
pause
|
||||||
echo ####### ERROR: ADMINISTRATOR PRIVILEGES REQUIRED #########
|
) ELSE (
|
||||||
echo This script must be run as administrator to work properly!
|
set rights_admin=1
|
||||||
echo If you're seeing this after clicking on a start menu icon, then right click on the shortcut and select "Run As Administrator".
|
|
||||||
echo ##########################################################
|
|
||||||
echo.
|
|
||||||
PAUSE
|
|
||||||
EXIT /B 1
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,8 +51,12 @@ goto main
|
||||||
|
|
||||||
:setup_wifi
|
:setup_wifi
|
||||||
cls
|
cls
|
||||||
netsh wlan add profile "filename=%mypath%Wi-Fi-Sincoolka.xml"
|
set cmd_user=current
|
||||||
netsh wlan add profile "filename=%mypath%Wi-Fi-Sincoolka 5G.xml"
|
IF %rights_admin% EQU 1 (
|
||||||
|
set cmd_user=all
|
||||||
|
)
|
||||||
|
netsh wlan add profile "filename=%mypath%Wi-Fi-Sincoolka.xml" user=%cmd_user%
|
||||||
|
netsh wlan add profile "filename=%mypath%Wi-Fi-Sincoolka 5G.xml" user=%cmd_user%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue