This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

StopNetPerfMon.exe Command-line options?

I need to do a scripted shutdown of the Orion services.

I know that I could use SC.EXE or NET STOP to do this, but I'm hoping that there is a way to trigger Orion Service Manager's "Shutdown Everything"  from the command-line.

 

Is this possible, and if so, what is the syntax?

Thanks,
-jack

  • I spoke with Dev, try this out.  Put this into a .bat file called StopNetPerfMon.bat and it just calls to stop services (not all Orion service are included but the main idea is clear):

      StopNetPerfMon.bat “c:\Program Files\SolarWinds\Orion\StopNetPerfMon.exe”
    The batch file also depicts syntax of command line usage of StopNetPerfMon.exe.

    set StopNetPerfMon=%1
    %StopNetPerfMon% -StopWeb "SolarWinds NetPerfMon"
    %StopNetPerfMon% -StopApp "SolarWinds Orion NPM"
    %StopNetPerfMon% -StopService "NetPerfMonService"
    %StopNetPerfMon% -StopService "SolarWindsAlertingEngine"
    %StopNetPerfMon% -StopService "SolarwindsSyslogService"
    %StopNetPerfMon% -StopService "SolarWindsTrapService"
    %StopNetPerfMon% -StopService "SolarwindsCustomPollingService"
    %StopNetPerfMon% -StopService "NetFlowService"
    %StopNetPerfMon% -StopService "OrionAppPoller"
    %StopNetPerfMon% -StopService "SolarWindsWirelessNetworksService"
    %StopNetPerfMon% -StopService "SolarWindsNetFlowReceiverService"
    %StopNetPerfMon% -StopService "SolarWindsFlowCorrelationService"
    %StopNetPerfMon% -StopService "SolarwindsJobEngine"
    %StopNetPerfMon% -StopService "SolarwindsJobScheduler"
    %StopNetPerfMon% -StopService "VoipMonitorService"
    %StopNetPerfMon% -StopService "OrionModuleEngine"

  • I tried your sample script. I don't know if this is what you mean by "not all Orion service are included",  but after it finished, these services were still running:

    SolarWinds Job Engine v2

    SolarWinds Collector Management Agent

    SolarWinds Collector Data Processor

    SolarWinds Collector Polling Controller

    SolarWinds Job Scheduler

    SolarWinds Job Engine

    SolarWinds Orion Information Service v1

    SolarWinds Information Service

  • Yep so you would need to add those with the syntax above

  • Does it matter what order I add these?

    Also, I'd like to make a feature request to have the "Shutdown Everything" option available from the command line. 

     

    Thanks,

    -jack

  • I see now that "SolarWinds Job Scheduler" and "SolarWinds Job Engine" were in the original script, but those services did not stop.

     

  • Is there an advantage of using this method compared to doing "net stop" and then "net start" for all the individual services? I second Jackwilson's idea of having "shutdown everything" option available from command line.

  • I just created a "orion stop all services.bat" file with the following contents:

    net stop SolarWindsAlertingEngine

    net stop SWCollectorDataProcessorSvc

    net stop SWCollectorManagementAgentSvc

    net stop SWCollectorPollingControllerSvc

    net stop SWInfoServiceSvc

    net stop SWInfoServiceSvcV3

    net stop SWJobEngineSvc

    net stop SWJobEngineSvc2

    net stop SWJobSchedulerSvc

    net stop "SolarWinds Orion NCM Caching Service"

    net stop "SolarWinds Orion NCM TFTP Server"

    net stop NetFlowService

    net stop OrionModuleEngine

    net stop "SolarWinds SFTP Server"

    Looks to be working as I would expect.

  • I know this is an old thread, but I found this works:

    StopNetPerfMon.exe -stopall

    <Sleep>

    StopNetPerfMon.exe -startall

  • Here is a powershell script I use, ymmv. We restart the orion/poller servers after OS updates, but use this script to restart the SW SQL server.

    # Stop all SolarWinds services on the various pollers and the Orion server
    # Stop the NetPerfMon website
    # Restart the Orion SQL server
    # Start all services and website

    $sendto          = "me@here.com","you@there.com"

    $orion           = "orion01"

    $pollers         = "poller02",`
                       "poller03",`
                       "poller04",`
                       "poller05"

    $web             = "web01"

    $agent           = "agent01"

    $sql             = "sql01"

    $services_common = "SWJMXBridgeSvc",`
                       "SolarWindsTrapService",`
                       "SWJobEngineSvc",`
                       "SWJobEngineSvc2",`
                       "OrionModuleEngine",`
                       "SWCollectorManagementAgentSvc",`
                       "SWCollectorDataProcessorSvc",`
                       "SWCollectorPollingControllerSvc"

    $services_main   = "SolarWindsSyslogService",`
                       "SolarWindsAlertingEngine",`
                       "SolarWindsAlertingServiceV2",`
                       "SWJobSchedulerSvc",`
                       "SWSEUMAgentProxySvc",`
                       "SWSEUMAgentSvc"

    $services_web    = "SWInfoServiceSvc",`
                       "SWInfoServiceSvcV3"


    $services_agent  = "SolarWindsAgent64"

    $services_orion  = $services_main + $services_common + $services_web
    $services_poller = $services_common + $services_web

    $siteName        = "SolarWinds NetPerfMon"

    function SW-Services {
        $type     = $args[0]
        $action   = $args[1]
        $servers  = $args[2]
        $services = $args[3]
        Write-Host "$type services on $servers - $action" -ForegroundColor Green
        foreach ($service in $services)
        {
            $current_svcs = get-service -ComputerName $servers -Name $service
            if ( $action -eq "Status" )
            {
                $current_svcs.Refresh()
                $current_svcs | ft -Property MachineName,DisplayName,Status -Autosize
            }
            elseif (( $action -eq "Stop" -And $current_svcs.Status -eq "Running") -Or ( $action -eq "Start" -And $current_svcs.Status -eq "Stopped" ))
            {
                foreach ($server in $servers)
                {
                    $current_server = get-service -ComputerName $server -Name $service
                    Write-Host "$server $service $action"
                    $current_server.$action()
                }
            }
            else
            {
                Write-Host "Not doing a $action because $service is $current_svcs.Status"
            }
        }
    }

    function SW-Website
    {
        $action  = $args[0]  # Action arg from function call
        Import-Module WebAdministration
        if ( $action -eq 'Start' )
        {
            Write-Host "SolarWinds NetPerfMon Website - Start" -ForegroundColor Green
            $block = {$siteName = $args[0]; Start-WebSite $siteName | Out-Null};  #siteName arg from Invoke-Command call
        }
        elseif ( $action -eq 'Stop' )
        {
            Write-Host "SolarWinds NetPerfMon Website - Stop" -ForegroundColor Green
            $block = {$siteName = $args[0]; Stop-WebSite $siteName | Out-Null};  #siteName arg from Invoke-Command call
        }
        else
        {
            Write-Host "SolarWinds NetPerfMon Website - Status" -ForegroundColor Green
            $block = {$siteName = $args[0]; Get-WebSite $siteName | Out-Default};  #siteName arg from Invoke-Command call
        }
        $session = New-PSSession -ComputerName $web
        Invoke-Command -Session $session -ScriptBlock $block -ArgumentList $siteName
        Remove-PSSession $session
    }

    function Restart-SQL {
        Write-Host "Restarting SQL server $sql.." -ForegroundColor Green
        Restart-Computer -ComputerName $sql -Force
        Write-Host "Waiting for SQL server $sql.." -ForegroundColor Green
        Start-Sleep 60
        Write-Host "Testing whether SQL is accessible yet.." -ForegroundColor Green
        # test access to DB server
        $port = 1433
        $sqltest = New-Object System.Net.Sockets.TcpClient;
        $attempt = 1
        $attempts = 20
        $success = $false
        while ($attempt -le $attempts -and -not $success) {
          try {
            Write-Host "Attempt $attempt..";
            Write-Host "Connecting to "$sql":"$port" (TCP)..";
            $sqltest.Connect($sql, $port);
            Write-Host "Connection successful`n" -ForegroundColor Green
            $success = $true
          } catch {
            # remember error information
            $ErrorMessage = $_.Exception.Message
            Start-Sleep 30
            $attempt++
          }
        }
        # error processing
        if (-not $success) {
            Write-Host "Connection failed with error:"  -ForegroundColor Yellow
            Write-Host "$ErrorMessage" -ForegroundColor Red
            Write-Host "You will need to figure out why SQL isn't available, then restart SolarWinds services manually." -ForegroundColor Yellow
            Exit 1
        }
        $sqltest.Dispose()
    }

    function Send-Mail {
        Write-Host "Enter your full name: " -ForegroundColor Magenta -NoNewline
        $fullname = Read-Host
        Write-Host "Enter your email address: " -ForegroundColor Magenta -NoNewline
        $email = Read-Host
        $from = "$fullname <${email}>"
        Write-Host "Ready to Send a Mail message to ${sendto}? Press Enter..." -ForegroundColor Magenta -NoNewline
        Read-Host
        Send-MailMessage -To $sendto -From $from -Subject "SolarWinds Services Restarted" -body "Solarwinds has been restarted to finish the patching process.`n`nThanks,`n${fullname}" -SmtpServer "smtp.corp.com"
        Write-Host "Email sent`n"  -ForegroundColor Magenta
    }

    function main {
        Clear-Host

        Write-Host 'Getting status...' -ForegroundColor Magenta
        SW-Services Orion  Status $orion   $services_orion
        SW-Services Poller Status $pollers $services_poller
        SW-Services Info   Status $web     $services_web
        SW-Website         Status
        SW-Services Agent  Status $agent   $services_agent

        Write-Host 'Is we is? Ready to stop SolarWinds services? Press Enter to continue…' -ForegroundColor Magenta -NoNewline
        Read-Host
        SW-Services Orion  Stop   $orion   $services_orion
        SW-Services Poller Stop   $pollers $services_poller
        SW-Services Info   Stop   $web     $services_web
        SW-Website         Stop
        SW-Services Agent  Stop   $agent   $services_agent

        Write-Host 'Getting status again...' -ForegroundColor Magenta
        SW-Services Orion  Status $orion   $services_orion
        SW-Services Poller Status $pollers $services_poller
        SW-Services Info   Status $web     $services_web
        SW-Website         Status
        SW-Services Agent  Status $agent   $services_agent

        Write-Host 'Moving on to SQL server restart. Press Enter to continue…' -ForegroundColor Magenta -NoNewline
        Read-Host
        Restart-SQL

        Write-Host 'Next up, restart SolarWinds services. Press Enter to continue…' -ForegroundColor Magenta -NoNewline
        Read-Host
        SW-Services Orion  Start  $orion   $services_orion
        SW-Services Poller Start  $pollers $services_poller
        SW-Services Info   Start  $web     $services_web
        SW-Website         Start
        SW-Services Agent  Start  $agent   $services_agent

        Write-Host 'Getting status one more time...' -ForegroundColor Magenta
        SW-Services Orion  Status $orion   $services_orion
        SW-Services Poller Status $pollers $services_poller
        SW-Services Info   Status $web     $services_web
        SW-Website         Status
        SW-Services Agent  Status $agent   $services_agent

        Send-Mail

        Write-Host "All done. Hope it was good for you." -ForegroundColor Cyan
    }

    main
  • Being the lazy admin, here is my solution:

    invoke-command -computer mypoller -scriptblock {Start-Process -FilePath "C:\Program Files (x86)\SolarWinds\Orion\StopNetPerfMon.exe" -ArgumentList "-startall" -Verb Open -Wait}