Open powershell-linus opened 6 years ago
Hello,
Anyone ?? A hint maybe ??
Thank you in advance
@powershell-linus Sorry, I have been pretty busy and haven't had the time to really look into this and provide any assistance. I'll try to look at this over the weekend and see what I can help with.
@proxb Firstly i would like to THANK you for this great module you have provided. I just got a bit downbeat because i tried to explain my problem(mostly because of lack of knowledge) in as much detail i could think of and i did not get any response. I understand that you have busy schedule so take your time and have a look whenever you can. I did not want to start the program going the sequential way but i have to show some progress. Anyhow this is a learning experience for me so the worst case scenario is to rebuilt the code using your module in a latter phase. Again THANK you for your time and effort for giving this for free (as well all other members contributing)
Hello all,
I have created also a thread in powershell.org asking for help but since my main issue is using the PoshRSJob module instead of background jobs i decided to post also here. For reference the link is https://powershell.org/forums/topic/gui-runspaces-poshrsjob-module/ and will copy it here also for convenience
A bit of introduction
I just started messing around with the world of powershell and unfortunately i am in deep water and would like your help guidance. The problem is that i do not have skills in programming so i can only go with the trial and error method to learn for now. The "masterplan" š is to provide a GUI to users to do multiple automated actions(e.g check free hard disk space,kill processes etc) in a pool of servers (100 and rising up fast). I have figured out how to do some basic stuff in a sequential way but because of the number of servers will rise up i have to implement a way of multitasking..
Problems experiencing using GUI
GUI freezes when a long running operation takes place and becomes unresponsive(imagine a long operation for each server)
Below i will present a very simple form utilizing powershell jobs in order to achieve multitasking(baby steps) that updates a progressbar. I have used powershell studio and export in a ps1 format in order for you to test. This is working OK š !! (I used the built-in functions in powershell studio so no big deal). I could press both buttons almost at the same time with no GUI freezing and checking with process explorer that two powershell.exe sub-processes are created..
PoshRSJob Implementation
The problem with powershell jobs is that there is no throttling and i believe there is a BIG overhead creating a new process for each job.This led me to chaotic world of runspaces.I found this excellent module of PoshRSJob (https://github.com/proxb/PoshRSJob that uses runspaces so you can multithread easier in Powershell.
I tried this very simplistic approach to import the PoshRSJob and replace the commands of powershell jobs with the ones of the module.(I told you i just started so cannot do much,be kind to me :)). The result is to have the commands running BUT two problems
########### 1.The progress bars are not updated
2.When i close the form The GUI leaves a zombie process when compiled as exe using Powershell studio ############ Here is the implementation of PoshRSJob instead of powershell jobs
Notes: You will get the below error if you use the latest version of PoshRSJob module , i had to replace the Start-RSJob.ps1 with the latest one of this location https://github.com/MVKozlov/PoshRSJob and the error is gone
Request-Help Needed.
I have read about synchronized hash use in order to exchange info between runspaces .(between forms controls in my case i think) but it is very difficult to comprehend š at the moment !!
Ideally i would like to provide me a working example of my code doing exactly the same using the PoshRSJob instead of Powershell jobs.The reason for this is to make comparisons and try to dig further,it would be HUGE help I am aware that this is advanced stuff and far beyond my level of expertise but it would be of great help to achieve my goal in an efficient manner.In the meantime i have learned a lot and getting excited about the capabilities and prospects of Powershell and runspaces.
Epilogue
I would like to thank everyone in advance and sorry for this large post