Multi USB OSDBootMedia Solution

Ask your PowerShell-related questions, including questions on cmdlet development!
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 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
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Multi USB OSDBootMedia Solution

Post by localpct »

Hello,
Now that I've been back in the office I see this script is amazing, but not quite what I'm looking for. Let me explain my use case:
We manually copy OSD boot media from a shared drive to USBs when the engineers require it, sometimes that requires drives to be formatted to FAT32
Last count is about 60 drives being updated

I would like to create a gui that the techs run after USBs are inserted
Snag_650bad.png
Snag_650bad.png (12.11 KiB) Viewed 1689 times
It lists the drives in the tree view
Techs click build
We use the script from earlier to build the drives
Snag_22d21.png
Snag_22d21.png (13.61 KiB) Viewed 1675 times
Once done, the status bar and progress bar both say complete
Snag_66c265.png
Snag_66c265.png (11.58 KiB) Viewed 1689 times

Finally, if the users attempt to start the application without USBs attached, I catch the error in the load event and advise them and close the form

Currently what I have is working better than I imagined but I think one thing would be nice
When the jobscript completes and there are more than 1 drive plugged in, I would like the treeview and progress bar step with it
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Multi USB OSDBootMedia Solution

Post by jvierra »

Sorry but that is a design issue. You will need to design your script to edtect the end of the job and then switch nodes.
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Multi USB OSDBootMedia Solution

Post by localpct »

That’s correct :)
Not a design issue, just need figure it out.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Multi USB OSDBootMedia Solution

Post by jvierra »

This is what the JobTracker control set is for.
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Multi USB OSDBootMedia Solution

Post by localpct »

My build button is a Button - Start Job control set
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Multi USB OSDBootMedia Solution

Post by jvierra »

I am sorry but I still can't understand what you are asking.
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Multi USB OSDBootMedia Solution

Post by localpct »

To update the treeview and progressbar I must add code to the -UpdateScript within my Start Job button’s click event, yes?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Multi USB OSDBootMedia Solution

Post by jvierra »

Yes. That is what teh script block is used for. There is a script block that is executed when the job finishes for post-job updates.
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Multi USB OSDBootMedia Solution

Post by localpct »

User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Multi USB OSDBootMedia Solution

Post by localpct »

My job appears to be updating everything besides the treeview just fine.
I found this
https://info.sapien.com/index.php/guis/ ... ew-control
and then the property NextNode, but I get this error

ERROR: Method invocation failed because [System.Windows.Forms.TreeNode] does not contain a method named 'NextNode'.
  1.     $results = Receive-Job -Job $Job
  2.                
  3.                 foreach ($item in $results | Where-Object {$_ -match "Make-OSDBootMedia.builddate"})
  4.                 {
  5.                     $richtextbox1.Text += $item
  6.                     $progressbaroverlay1.PerformStep()
  7.                     $progressbaroverlay1.TextOverlay = 'Starting Next Drive'
  8.                    
  9.                     $node = $treeView1.SelectedNode
  10.                     while ($node -ne $null)
  11.                     {
  12.                         $node = $node.NextNode
  13.                         $treeview1.SelectedNode.NextNode($node)
  14.                     }
  15.                    
  16.                 }
This topic is 2 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