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 LICENSE NUMBERS, ACTIVATION 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.
This topic is 11 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
coder12345
Posts: 9
Last visit: Wed Sep 23, 2015 7:54 am

displaying progress while restarting a service

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

}
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

displaying progress while restarting a service

Post 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
David
SAPIEN Technologies, Inc.
User avatar
coder12345
Posts: 9
Last visit: Wed Sep 23, 2015 7:54 am

displaying progress while restarting a service

Post by coder12345 »

Ah, refresh is great idea, thank you, David!
This topic is 11 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.