Updating forms while running a Job

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

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 2 years and 10 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.
Locked
User avatar
brianclark
Posts: 23
Last visit: Wed Feb 22, 2023 5:19 pm

Updating forms while running a Job

Post by brianclark »

I have a job that runs using the Jobtracker, and has multiple parts to said job.
I have read, and used the jobtracker quite a bit, however I am still a bit uneducated as to how to update fields of a form while a Job is in progress.
For example, I have an entire task that runs in one Jobscript of the jobtracker to rename a cluster shared volume in failover cluster manager, as well as rename the volume label. That task is then broken down into sub-tasks within the scriptblock;
1. Get the cluster shared volume based on Variables passed in.
2. Get the volume information based on the information returned in #1
3. Update fields (Log window textbox) on the form with information provided from the items above.
4. Rename volume in Failover Cluster Manager
5. Update (log window textbox) of completed task, or failure.
6. Rename the volume label on the specific host
7. Update (log window textbox) of completed task or failure.
8. CompletedScript runs.

Is there a way to update textboxes in the main GUI with completed task information while the script is running? I am assuming this would use the "UpdateScript block, however I don't really understand how that would work.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Updating forms while running a Job

Post by jvierra »

Everything returned from the scriptblock is read in the UpdateScript block. Look at the initial example form provided as a form type. It demonstrates what is happening.
User avatar
brianclark
Posts: 23
Last visit: Wed Feb 22, 2023 5:19 pm

Re: Updating forms while running a Job

Post by brianclark »

Thanks for the reply. I will take another look at that and get back if anything is unclear.
This topic is 2 years and 10 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.
Locked