Created
August 25, 2021 12:45
-
-
Save SoulOfUniverse/c683cb9efeb8795f626c5e978a9a80ac to your computer and use it in GitHub Desktop.
Sopping Solr/Nssm services Powershell prior starting up Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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