Created
April 20, 2016 00:51
-
-
Save a5ync/4d4cf7f134a350481ba2c3d9bdb4d9a5 to your computer and use it in GitHub Desktop.
Check if windows service is installed and running
This file contains hidden or 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
$serviceName = "Dhcp" | |
$service = Get-Service $serviceName -ErrorAction SilentlyContinue | |
if($service) | |
{ | |
Write-host service $service.Name is $service.Status | |
} | |
else | |
{ | |
Write-host what service? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment