Add Network Configuration Launcher scripts for managing network adapters
This commit is contained in:
commit
7b4176a7eb
2 changed files with 546 additions and 0 deletions
33
NetworkConfig.bat
Normal file
33
NetworkConfig.bat
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
@echo off
|
||||
:: Network Configuration Launcher
|
||||
:: This batch file launches the PowerShell script with administrator privileges
|
||||
|
||||
title Network Adapter Configuration Tool
|
||||
|
||||
:: Check if running as administrator
|
||||
net session >nul 2>&1
|
||||
if %errorLevel% == 0 (
|
||||
goto :run_script
|
||||
) else (
|
||||
echo Requesting administrator privileges...
|
||||
goto :elevate
|
||||
)
|
||||
|
||||
:elevate
|
||||
:: Request administrator elevation
|
||||
powershell -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
|
||||
exit /b
|
||||
|
||||
:run_script
|
||||
:: Run the PowerShell script
|
||||
cd /d "%~dp0"
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0Set-NetworkAdapter.ps1"
|
||||
|
||||
:: Pause if there was an error
|
||||
if %errorLevel% neq 0 (
|
||||
echo.
|
||||
echo An error occurred while running the script.
|
||||
pause
|
||||
)
|
||||
|
||||
exit /b
|
||||
Loading…
Add table
Add a link
Reference in a new issue