Skip to content

Instantly share code, notes, and snippets.

@SoulOfUniverse
Created August 25, 2021 12:45
Show Gist options
  • Save SoulOfUniverse/c683cb9efeb8795f626c5e978a9a80ac to your computer and use it in GitHub Desktop.
Save SoulOfUniverse/c683cb9efeb8795f626c5e978a9a80ac to your computer and use it in GitHub Desktop.
Sopping Solr/Nssm services Powershell prior starting up Docker
Write-Host "Scanning any solr or nssm services to stop them in order to run docker" -ForegroundColor Green
$services = get-wmiobject win32_service | Where-Object {$_.pathname -match 'nssm' -or $_.name -match 'solr' }
$services | Foreach-Object {
if ($_.State -eq "Running"){
$name = $_.Name
Write-Host "The solr service $name is running, we are stopping the service..." -ForegroundColor Yellow
Stop-Service -Name $_.Name
Write-Host "$name service is stopped" -ForegroundColor Green
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment