USMT Progress

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 7 years and 2 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
japolonio
Posts: 7
Last visit: Fri Jul 29, 2022 7:20 am

USMT Progress

Post by japolonio »

I am building a GUI for Microsoft's USMT utility. Once running USMT tracks its progress in a text file. I tried running a timer every second on the file to append the text to my richtextbox form. For some reason it will only display the text once the whole process is done, not while its running. Here is my code

COMMAND

$timer1.Start()
$ScriptPathLocation\ScanState.exe "$BrowsePath\$SplitUser" /i:"$ScriptPathLocation\MigApp.xml" /v:5 /i:"$ScriptPathLocation\MigUser.xml" /Progress:"$USMTLogLocation\Progress.log" /l:"$USMTLogLocation\USMTScan.log" /o /localonly /c /ue:*\* /ui:$SelectedUser
$timer1.Stop()

$timer1_Tick={
$DisplayProgress = Get-Content -Path "$USMTLogLocation\Progress.log" | Out-String
$ProgressTextbox.AppendText($DisplayProgress)
}
User avatar
Alexander Riedel
Posts: 8488
Last visit: Mon Apr 15, 2024 3:28 pm
Answers: 20
Been upvoted: 37 times

Re: USMT Progress

Post by Alexander Riedel »

[Moved to correct forum by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: USMT Progress

Post by jvierra »

To track a command that outputs dots or other messages as progress in a console you would use the JobTracker custom control and use the UpdateJob script block to update teh form based on the output returned from the job.
DevinL
Posts: 1098
Last visit: Tue Jun 06, 2017 9:15 am

Re: USMT Progress

Post by DevinL »

Feel free to take a look at this article on the info.sapien site: http://info.sapien.com/index.php/guis/g ... sive-forms

The article ends with a link to download the sample or you can download from the attachment below.

I hope this gets you pointed in the right direction.
JobProgressBar.zip
(3.86 KiB) Downloaded 178 times
DevinL
SAPIEN Technologies, Inc.
This topic is 7 years and 2 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