Started SetStaticRoute.ps1 script.
This commit is contained in:
parent
63822a21fe
commit
18b3e49270
1 changed files with 47 additions and 0 deletions
47
SetStaticRoute.ps1
Normal file
47
SetStaticRoute.ps1
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
|
||||||
|
<#
|
||||||
|
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?"
|
||||||
Loading…
Add table
Reference in a new issue