10 Replies Latest reply on Aug 8, 2018 9:48 AM by cmblackburn

    StopNetPerfMon.exe Command-line options?

    Jackwilson

      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

        • Re: StopNetPerfMon.exe Command-line options?
          bshopp

          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"

          • Re: StopNetPerfMon.exe Command-line options?
            netlogix

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

            StopNetPerfMon.exe -stopall

            <Sleep>

            StopNetPerfMon.exe -startall

            1 of 1 people found this helpful
            • Re: StopNetPerfMon.exe Command-line options?
              lafong

              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
              • Re: StopNetPerfMon.exe Command-line options?
                cmblackburn

                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}

                1 of 1 people found this helpful