204 lines
4.3 KiB
Batchfile
204 lines
4.3 KiB
Batchfile
@echo off
|
|
|
|
set mypath=%~dp0
|
|
set rights_admin=0
|
|
|
|
:: Check admin rights
|
|
NET SESSION >nul 2>&1
|
|
|
|
IF NOT %ERRORLEVEL% EQU 0 (
|
|
echo ############### !! FRIENDLY NOTICE ##############
|
|
echo # Please, run this script as an administrator. #
|
|
echo # Otherwise, the added Wi-Fi network will #
|
|
echo # NOT remember your username and password. #
|
|
echo # #
|
|
echo # Please close this window, right-click the #
|
|
echo # sin-setup.bat, and select #
|
|
echo # Run as administrator. #
|
|
echo #################################################
|
|
echo.
|
|
pause
|
|
) ELSE (
|
|
set rights_admin=1
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
:: Main loop
|
|
|
|
:main
|
|
cls
|
|
ECHO What you want to do now?
|
|
ECHO 1. Configure Wi-Fi connection - Sincoolka FT (recommended)
|
|
ECHO 2. Configure Wi-Fi connection - Sincoolka (if the FT does not work properly)
|
|
ECHO 3. Configure Wi-Fi connection - Sincoolka 5G (expert, 5 GHz only)
|
|
ECHO.
|
|
ECHO 4. Remove all Sincoolka profiles
|
|
ECHO.
|
|
IF %rights_admin% EQU 1 (
|
|
ECHO 5. Configure wired connection for 802.1X
|
|
ECHO.
|
|
)
|
|
ECHO 9. Print MAC adresses
|
|
ECHO 0. Exit
|
|
ECHO.
|
|
set choice=
|
|
set /p choice=Choice:
|
|
if not '%choice%'=='' set choice=%choice:~0,1%
|
|
if '%choice%'=='1' goto setup_wifi_ft
|
|
if '%choice%'=='2' goto setup_wifi
|
|
if '%choice%'=='3' goto setup_wifi_5g
|
|
if '%choice%'=='4' goto cleanup_wifi
|
|
IF %rights_admin% EQU 1 (
|
|
if '%choice%'=='5' goto setup_eth
|
|
)
|
|
if '%choice%'=='9' goto print_mac
|
|
if '%choice%'=='0' EXIT
|
|
ECHO "%choice%" is not valid, try again
|
|
ECHO.
|
|
goto main
|
|
|
|
|
|
|
|
|
|
|
|
:: Import Sincoolka FT Wi-Fi profile
|
|
|
|
:setup_wifi_ft
|
|
cls
|
|
set cmd_user=current
|
|
IF %rights_admin% EQU 1 (
|
|
set cmd_user=all
|
|
)
|
|
netsh wlan add profile "filename=%mypath%Wi-Fi-SincoolkaFT.xml" user=%cmd_user%
|
|
|
|
echo.
|
|
|
|
set /p iface="Press Enter to continue . . . "
|
|
goto main
|
|
|
|
:: Import Sincoolka Wi-Fi profile
|
|
|
|
:setup_wifi
|
|
cls
|
|
set cmd_user=current
|
|
IF %rights_admin% EQU 1 (
|
|
set cmd_user=all
|
|
)
|
|
netsh wlan add profile "filename=%mypath%Wi-Fi-Sincoolka.xml" user=%cmd_user%
|
|
|
|
echo.
|
|
|
|
set /p iface="Press Enter to continue . . . "
|
|
goto main
|
|
|
|
:: Import Sincoolka 5G Wi-Fi profile
|
|
|
|
:setup_wifi_5g
|
|
cls
|
|
set cmd_user=current
|
|
IF %rights_admin% EQU 1 (
|
|
set cmd_user=all
|
|
)
|
|
netsh wlan add profile "filename=%mypath%Wi-Fi-Sincoolka5G.xml" user=%cmd_user%
|
|
|
|
echo.
|
|
|
|
set /p iface="Press Enter to continue . . . "
|
|
goto main
|
|
|
|
|
|
:cleanup_wifi
|
|
cls
|
|
:: Cleanup all our Wi-Fi profiles
|
|
netsh wlan delete profile name="Sincoolka" i=*
|
|
netsh wlan delete profile name="Sincoolka FT" i=*
|
|
netsh wlan delete profile name="Sincoolka 5G" i=*
|
|
|
|
echo.
|
|
|
|
set /p iface="Press Enter to continue . . . "
|
|
goto main
|
|
|
|
|
|
|
|
:: Start dot3svc service
|
|
|
|
:setup_eth
|
|
cls
|
|
net start dot3svc >nul 2>&1
|
|
IF %ERRORLEVEL% EQU 0 (
|
|
echo Enabled enterprise security for wired connection
|
|
) ELSE (
|
|
IF %ERRORLEVEL% EQU 2 (
|
|
echo Enabled enterprise security for wired connection
|
|
) ELSE (
|
|
echo "Unable to enable enterprise security -> abort"
|
|
goto main
|
|
)
|
|
)
|
|
|
|
:: Configure dot3svc service to start on PC boot
|
|
REG add "HKLM\SYSTEM\CurrentControlSet\services\dot3svc" /v Start /t REG_DWORD /d 2 /f >nul 2>&1
|
|
IF %ERRORLEVEL% EQU 0 (
|
|
echo Enterprise security configured to start on PC boot
|
|
) ELSE (
|
|
echo Unable to configure enterprise security to start on PC boot -> abort
|
|
goto main
|
|
)
|
|
|
|
echo.
|
|
echo.
|
|
|
|
:setEth
|
|
|
|
:: Print all network interfaces
|
|
echo List of Available Interfaces:
|
|
echo.
|
|
wmic nic where 'NOT Manufacturer like "%%Microsoft%%" and PhysicalAdapter=TRUE and NOT Manufacturer like "%%Windows%%"' get Manufacturer,MACAddress,NetConnectionID 2>nul
|
|
IF NOT %ERRORLEVEL% EQU 0 (
|
|
getmac /v 2>nul
|
|
IF NOT %ERRORLEVEL% EQU 0 (
|
|
:: netsh lan show profiles
|
|
ipconfig /all
|
|
)
|
|
)
|
|
|
|
echo.
|
|
set /p iface="Enter Ethernet Interface NetConnectionID or press Enter to abort: "
|
|
|
|
if "%iface%" == "" (
|
|
goto endEth
|
|
)
|
|
|
|
netsh lan add profile "filename=%mypath%Ethernet.xml" interface="%iface%"
|
|
|
|
if %errorlevel% GTR 0 (
|
|
set iface=
|
|
|
|
cls
|
|
goto setEth
|
|
)
|
|
:endEth
|
|
|
|
goto main
|
|
|
|
|
|
|
|
|
|
|
|
:print_mac
|
|
cls
|
|
wmic nic where 'NOT Manufacturer like "%%Microsoft%%" and NOT Manufacturer like "%%Windows%%"' get MACAddress,Caption,NetConnectionID 2>nul
|
|
IF NOT %ERRORLEVEL% EQU 0 (
|
|
getmac /v 2>nul
|
|
IF NOT %ERRORLEVEL% EQU 0 (
|
|
:: netsh lan show profiles
|
|
ipconfig /all
|
|
)
|
|
)
|
|
set /p iface="Press Enter to continue . . . "
|
|
goto main
|