We have a Windows process which needs to be restarted everyday at 5:00 am and in order to do this i have created a PowerShell script with the below commands.
$srv1 = Get-Service -Computer $Server1 -Name $Service1
$srv1.stop()
This PowerShell script is called via Task Scheduler at 5:00 am and this works fine most of the times and the Windows process gets stopped. But few days, this gets stuck in the
Stopping
status for more than an hour and not gets stopped.
Could you please let me know if there is any method i can use to force stop the Windows process?
1