Skip to content

Commit 603a4f0

Browse files
committed
tweak
1 parent 7878648 commit 603a4f0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Edit-Routes.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Param(
2121
[Parameter(Mandatory=$True)]
2222
[System.String] $nextHop,
2323
[Parameter(Mandatory=$True)]
24-
[System.UInt32] $interfaceIndex,
24+
[System.Object] $interface,
2525
[Parameter(Mandatory=$True)]
2626
[System.String] $target
2727
)
@@ -31,7 +31,7 @@ Param(
3131
# $persistentStore = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Store]::"PersistentStore"
3232

3333
Write-Output "[*] Action : $action"
34-
Write-Output "[*] Interface index : $interfaceIndex"
34+
Write-Output "[*] Interface : $interface"
3535
Write-Output "[*] Next hop : $nextHop"
3636
Write-Output "[*] Target file : $target"
3737

@@ -46,13 +46,13 @@ foreach ($entry in [System.IO.File]::ReadLines($target)) {
4646
switch ($action) {
4747
"add" {
4848
Write-Output "[+] Adding new route to $entryCIDR"
49-
netsh int ipv4 add route prefix=$entryCIDR interface=$interfaceIndex nexthop=$nextHop metric=$routeMetric store=persistent
50-
# New-NetRoute -DestinationPrefix $entryCIDR -InterfaceIndex $interfaceIndex -NextHop $nextHop -RouteMetric $routeMetric -PolicyStore $persistentStore
49+
netsh int ipv4 add route prefix=$entryCIDR interface=$interface nexthop=$nextHop metric=$routeMetric store=persistent
50+
# New-NetRoute -DestinationPrefix $entryCIDR -interface $interface -NextHop $nextHop -RouteMetric $routeMetric -PolicyStore $persistentStore
5151
}
5252
"remove" {
5353
Write-Output "[-] Removing route to $entryCIDR"
54-
netsh int ipv4 delete route prefix=$entryCIDR interface=$interfaceIndex nexthop=$nextHop store=persistent
55-
# Remove-NetRoute -DestinationPrefix $entryCIDR -InterfaceIndex $interfaceIndex -NextHop $nextHop -RouteMetric $routeMetric -PolicyStore $persistentStore
54+
netsh int ipv4 delete route prefix=$entryCIDR interface=$interface nexthop=$nextHop store=persistent
55+
# Remove-NetRoute -DestinationPrefix $entryCIDR -interface $interface -NextHop $nextHop -RouteMetric $routeMetric -PolicyStore $persistentStore
5656
}
5757
}
5858

0 commit comments

Comments
 (0)