Hi,
I have a 1600~ (currently) line Powershell script that I use to create AD OUs and Import GPO Objects so that I can keep consistency when installing new networks. I want to be able to show a progress bar on the script but I don't want to have to manually update the progress throughout the script.
I know how to get the amount of lines in a script by using Get-Content which is rather easy, is there any way that I can use this info to pipe into a progress bar using the current line being progressed by powershell?
For example, when the script starts lets say it works out there are 1600 lines using Get-Content then displays a progress bar at a given percentage derived from the fact that there are x number of line divided by 100% meaning 1% is equal to 16 lines? The script would then update the progress bar by 1% after every 16 lines.
The whole thing hinges on being able to work out on the fly the current line being processed, the rest of the script wont be too difficult but I cant seem to work this bit out. Any input would be greatly appreciated.
Cheers