displaying progress while restarting a service

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
coder12345
Posts: 9
Joined: Tue Jul 10, 2012 11:13 pm

displaying progress while restarting a service

Post by coder12345 » Mon Sep 03, 2012 9:19 am

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."

}

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

displaying progress while restarting a service

Post by davidc » Tue Sep 04, 2012 7:40 am

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
David
SAPIEN Technologies, Inc.

User avatar
coder12345
Posts: 9
Joined: Tue Jul 10, 2012 11:13 pm

displaying progress while restarting a service

Post by coder12345 » Tue Sep 04, 2012 8:37 am

Ah, refresh is great idea, thank you, David!