E
E
Evgeniy Dikevich2018-07-12 10:13:58
PowerShell
Evgeniy Dikevich, 2018-07-12 10:13:58

How to determine that the service has started?

There are several services that must be started after one particular one. You have to wait until it is fully loaded. An attempt to force the service to start in a job was not successful. Maybe someone solved this issue?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
azarij, 2018-07-12
@azarij

how do you determine that the service has fully loaded?
if it changes to running status then:
$service_name = "winrm"
do{
$service_status = (get-service $service_name).status
if ($service_status -ne "running"){
"Service $service_name is not running!"
}
else {
"Service $service_name has started. Exiting..."
}
sleep 1
}
while($service_status -ne "running")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question