Skip to Content
Author's profile photo Former Member

Simple managment(PowerShell) Saprouter on Windows

Good afternoon, colleagues.

Sorry for my English=)

During continuous operation, with facilities for saprouter I wrote a little utility on the powershell. It consists of several items and allows you to perform operations with minimal saprouter. If you want you can extend the functionality.

The header shows the status of the service, it is highlighted in color depending on the status (green – works, all the rest – red). You can see all the connections (in fact this is a sample of the command netstat, but using the standard ports saprouter), view a log of connections, the routing table. Stop and start the service (in my case, after a stop, a copy is made before the start of the log file to a folder connection log, which I created in the root saprouter, this is done in order to preserve the history of connections, files ravine called by the current date and time). If You do not need the log files, then just remove the line:

Copy-Item $ log-Destination ($ saprouter_path + “\ logs-” + ((Get-Date-Format g)-replace “\.”, “_”-Replace “:”, “_”-replace “”, “-“))

Script need to run this on the server where the service saprouter. Check path to your saprouter and in the case of differences change.

Here is script



$path = “C:\SapRouter\logs”

$pathRouter = “C:\SapRouter\saprouttab”

$saprouter_path = “C:\SapRouter\log”

$log = ‘C:\SapRouter\logs’

$header = “`n—SAPROUTER—“

$choice = “”

$service = “saprouter”

$menu =”

1 – show current connections saprouter

2 – view a log of connections

3 – view routes tab file | change

4 – stop service saprouter

5 – start service saprouter

6 – clear screen

0 – exit”


#Menu have a some points

while($choice -ne 0){

if((Get-Service $service).Status -eq “running”){

    Write-Host $header “Runing” -ForegroundColor green



        Write-Host $header (Get-Service $service).Status -ForegroundColor Red


Write-Host $menu

$choice = Read-Host(“Select the menu item”)

switch ($choice){

    0 {Write-Host “Bye bye!”;Break}

    1 {Write-Host “`n” (“-“*30) “Saprouter connection” -ForegroundColor Green

        netstat -abn | Select-String -Pattern “32[0-9][0-9]” -Context 1,1}

    2 {Write-Host “`n” (“-“*30) “Log connections” “`n” -ForegroundColor Green

        Notepad $path}

    3 {Write-Host “`n” (“-“*30) “Routes table” “`n” -ForegroundColor Green

        Notepad $pathRouter}

    4 {Stop-Service $service}

    5 {Copy-Item $log -Destination ($saprouter_path + “\logs-” + ((Get-Date -Format g) -replace “\.”,”_” -replace “:”,”_” -replace ” “,”-“))

        Start-Service $service}

    6 {Clear-host}



Here is the output current connections.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Andy Silvey
      Andy Silvey

      Hi Stepan,

      nice job 🙂


      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Andy,

      thank you=).

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      I have made a small but pleasant change. Now directly from the menu, you can open the file routes through the notepad and edit it. Also through the notepad is opened through the same menu log, so it is more convenient to browse and search for it. =)