Page 1 of 1

displaying progress while restarting a service

Posted: Mon Sep 03, 2012 9:19 am
by coder12345
Mighty all, I'm observing the following behavior in the script below:

form loads for several seconds (which actually are required to restart the service) and the "post service restart" message.

What I would expect to see is: form loads, the "please wait" message is displayed, form freezes for a time needed for restarting a service, "post service restart" text is displayed.

Please let me know if my expectations are wrong andor if there is a better way of indicating to an end user the fact that a service is restarting.

Thanks in advance!

$FormEvent_Load={
$label.Text = "Changes are being applied, please be patient."
Restart-Service servicename
$label.Text = "Changes have been applied."

}

displaying progress while restarting a service

Posted: Tue Sep 04, 2012 7:40 am
by davidc
You can try to refresh the form before calling Restart-Service.

$form.Refresh()

Or you can use the Job Tracker Control Set to run the Restart Service command in a job and update the label when the job finishes.

David

displaying progress while restarting a service

Posted: Tue Sep 04, 2012 8:37 am
by coder12345
Ah, refresh is great idea, thank you, David!