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)
3131# $persistentStore = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Store]::"PersistentStore"
3232
3333Write-Output " [*] Action : $action "
34- Write-Output " [*] Interface index : $interfaceIndex "
34+ Write-Output " [*] Interface : $interface "
3535Write-Output " [*] Next hop : $nextHop "
3636Write-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