Selasa, 28 November 2017

How To Terminal Too Get-Go Service Using Powershell Until Service Condition Equal To Started Or Stopped

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














AT the cease of script compilation y'all drib dead the condition of service on your screen.

Thank you!!!



Sumber https://linuxhowtoguide.blogspot.com/

Tidak ada komentar:

Posting Komentar