Powershell gives us functionality to halt or showtime service until either it's fully stopped or started.
Lest re-create together with glue this script into notepad together with salve every moment stop-start-service.ps1 name. supervene upon service cite alongside the service cite y'all desire to restart. inward my case, I am restarting World broad spider web service.
@" =============================================================================== Title: Start together with Stop Service Description: Stop, Start Requirements: Windows Powershell Author: Amar Singh Date: November 29, 2017 =============================================================================== "@ # Define Service Name $servicename = "w3svc" #To halt the service Stop-Service $servicename -Verbose do { Start-Sleep ten } until((Get-Service $servicename).Status -eq "stopped") #To Start Service Start-Service $servicename -Verbose produce { Start-Sleep ten } until ((Get-Service $servicename).Status -eq "running") #To Validate service status Get-Service $servicename start-sleep 10
Tidak ada komentar:
Posting Komentar