none
Powerhsell progress bar during an operation RRS feed

  • Question

  • Hi,

    Id like to try and use the progress bar features from

    New-Object

    System.Windows.Forms.ProgressBar

    but I can't find any examples on how to use this during an operation.

    I have a command which I use to create a CSV file with various user information..

    Get-QADUser -sizelimit 0 | export-csv c:\pathtocsv.csv

    what i'd like to do is get the progress bar to be displayed in a separate form whilst the operation from get-qaduser is performed.

    any help appreciated - thanks

    Denis

     


    Regards,

    Denis Cooper

    MCITP EA - MCT

    Help keep the forums tidy, if this has helped please mark it as an answer

    My Blog

    LinkedIn:

    Monday, January 27, 2014 3:48 PM

Answers

  • Hi Denis,

    your progress-bar form has a property named value (which takes an integer value. Set it to 40 and you get 40% progress on your bar).

    The thing is, in order to calculate the percentage you are at, you need to know the maximum number, the current number and find a way to write it during runtime.

    And if I tried it, my boss would tell me to spend my time more usefully (If he caught me at it, that is).

    Good luck if you go for it (and if there's a simple way that has eluded me: I'll be happy to learn a bit more :) )

    Cheers,
    Fred


    There's no place like 127.0.0.1


    • Edited by FWN Monday, January 27, 2014 4:08 PM
    • Marked as answer by Denis Cooper Tuesday, March 11, 2014 10:15 PM
    Monday, January 27, 2014 4:07 PM
  • Can't really be done.  Get_QADUser does not have a callback or any way to check its progress.

    ¯\_(ツ)_/¯

    • Marked as answer by Denis Cooper Tuesday, March 11, 2014 10:15 PM
    Monday, January 27, 2014 8:58 PM

All replies

  • Hi Denis,

    your progress-bar form has a property named value (which takes an integer value. Set it to 40 and you get 40% progress on your bar).

    The thing is, in order to calculate the percentage you are at, you need to know the maximum number, the current number and find a way to write it during runtime.

    And if I tried it, my boss would tell me to spend my time more usefully (If he caught me at it, that is).

    Good luck if you go for it (and if there's a simple way that has eluded me: I'll be happy to learn a bit more :) )

    Cheers,
    Fred


    There's no place like 127.0.0.1


    • Edited by FWN Monday, January 27, 2014 4:08 PM
    • Marked as answer by Denis Cooper Tuesday, March 11, 2014 10:15 PM
    Monday, January 27, 2014 4:07 PM
  • Thanks. That's what I was thinking that you would need to know the min and max and use a for each. Guess I'll just use a please wait prompt instead. Unless anyone else has any ideas.

    Regards,

    Denis Cooper

    MCITP EA - MCT

    Help keep the forums tidy, if this has helped please mark it as an answer

    My Blog

    LinkedIn:

    Monday, January 27, 2014 8:02 PM
  • Can't really be done.  Get_QADUser does not have a callback or any way to check its progress.

    ¯\_(ツ)_/¯

    • Marked as answer by Denis Cooper Tuesday, March 11, 2014 10:15 PM
    Monday, January 27, 2014 8:58 PM
  • See - only a callback can make you happy... 

    ¯\_(ツ)_/¯

    Tuesday, March 11, 2014 10:58 PM