Posted On March 31, 2019

Quick and Dirty Script to Watch and Start / Restart Windows Service

kimconnect 0 comments
blog.KimConnect.com >> Windows >> Quick and Dirty Script to Watch and Start / Restart Windows Service
// powershell.exe
// -ExecutionPolicy Bypass c:\scripts\serviceCheck.ps1
$serviceName = '[input-service-name-here]'
$arrService = Get-Service -Name $serviceName
while ($arrService.Status -ne 'Running')
{
Start-Service $serviceName
$arrService.Refresh()
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Find Empty Directories

$directories="\\FILESERVER01\SHARE01" # Dynamic Credential method 1 $who = whoami if ($who.substring($who.length-2, 2) -eq "-admin"){$username=$who;} else…

How to recreate user profile on Windows 7

Method 1: You can do it with the User Profiles dialog in System Properties: Log…

Windows Error When Joining Domain

Error Message: ---------------------------Computer Name/Domain Changes---------------------------Changing the Primary Domain DNS name of this computer to ""…