47 lines
No EOL
1.7 KiB
PowerShell
47 lines
No EOL
1.7 KiB
PowerShell
|
|
<#
|
|
NetworkUtilities - SetStaticRoute
|
|
Copyright (c) 2026 ACO Services Inc.
|
|
Developed by Tanner Van Teeffelen
|
|
#>
|
|
|
|
Clear-Host
|
|
|
|
Add-Type -AssemblyName System.Windows.Forms
|
|
|
|
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(` [Security.Principal.WindowsBuiltInRole] "Administrator")) {
|
|
Write-Host "Insufficient permissions to run this script. Please run this as an administrator.`n" -ForegroundColor Red
|
|
$HOST.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | OUT-NULL
|
|
$HOST.UI.RawUI.Flushinputbuffer()
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "-------------------------------------------" -ForegroundColor Blue
|
|
Write-Host "|NetworkUtilities - SetStaticRoute |" -ForegroundColor Blue
|
|
Write-Host "|Developed by Tanner Van Teeffelen |" -ForegroundColor Blue
|
|
Write-Host "|Copyright ACO Services Inc. 2026 |" -ForegroundColor Blue
|
|
Write-Host "-------------------------------------------`n" -ForegroundColor Blue
|
|
|
|
# 1 - Get the desired IP address.
|
|
$ipAddress = Read-Host "Which IP address do you want to staticly route?"
|
|
|
|
# 2 - Get the desired interface.
|
|
$interfaceChoiceValid = "false"
|
|
|
|
while ($interfaceChoiceValid -eq "false"){
|
|
$interfaceChoice = Read-Host "Do you know the index of your desired VPN interface? (y/n)"
|
|
if ($interfaceChoice.ToLower() -eq "y"){
|
|
$interfaceChoiceValid = "true"
|
|
}
|
|
elseif ($interfaceChoice.ToLower() -eq "n"){
|
|
$interfaceChoiceValid = "true"
|
|
Write-Host "Showing all available interfaces..."
|
|
sleep 3
|
|
route print
|
|
}
|
|
else{
|
|
Write-Host "Please put in a valid choice."
|
|
}
|
|
}
|
|
|
|
$interfaceIndex = Read-Host "Which interface index do you want to staticly route through?" |