Created
December 15, 2022 21:19
-
-
Save gillissm/d25f0f8bb3fb72fc7569dc28a8d1ea1e to your computer and use it in GitHub Desktop.
PowerShell to Stop All Dev Related Services. Be sure to run as Admin.
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
#Requires -RunAsAdministrator | |
if($(Get-Service W3SVC).Status -eq 'Running'){ | |
Write-Host "W3SVC is running and will be stopped" | |
Stop-Service W3SVC | |
Write-Host "W3SVC is stopped." -BackgroundColor Red | |
} | |
else { | |
Write-Host "W3SVC is already stopped" -BackgroundColor DarkGray | |
} | |
Write-Host "" | |
if($(Get-Service MSSQLSERVER).Status -eq 'Running'){ | |
Write-Host "MSSQLSERVER is running and will be stopped" | |
Stop-Service MSSQLSERVER | |
Write-Host "MSSQLSERVER is stopped." -BackgroundColor Red | |
} | |
else{ | |
Write-Host "MSSQLSERVER is already stopped" -BackgroundColor DarkGray | |
} | |
Write-Host "" | |
if($(Get-Service solrsolr-8.1.1).Status -eq 'Running'){ | |
Write-Host "solrsolr-8.1.1 is running and will be stopped" | |
Stop-Service solrsolr-8.1.1 | |
Write-Host "solrsolr-8.1.1 is stopped." -BackgroundColor Red | |
} | |
else{ | |
Write-Host "solrsolr-8.1.1 is already stopped" -BackgroundColor DarkGray | |
} | |
Write-Host "" | |
if($(Get-Service solr-8.8.2).Status -eq 'Running'){ | |
Write-Host "solr-8.8.2 is running and will be stopped" | |
Stop-Service solr-8.8.2 | |
Write-Host "solr-8.8.2 is stopped." -BackgroundColor Red | |
} | |
else{ | |
Write-Host "solr-8.8.2 is already stopped" -BackgroundColor DarkGray | |
} | |
Write-Host "" | |
# if(($(Get-Service docker) -eq $null) -or ($(Get-Service docker).Status -eq 'Stopped')) | |
# { | |
Write-Host "Docker Desktop is not running" | |
& "C:\Program Files\Docker\Docker\Docker Desktop.exe" | |
Write-Host "Docker Desktop is running." -BackgroundColor Green | |
# } | |
# else{ | |
# Write-Host "Docker Desktop is already running" -BackgroundColor DarkGray | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment