powershell - Progress bar in Power shell script possible? -


I'm curious about creating a progress bar for a function, though I'm trying to last it Applying to your code, but there is no luck ....

Is it possible, this program reads a list of SVR names and then basically obtaining information from an SVR and The file invites the file to write so i have raw Data logs, however, I'm tired of seeing a blank screen so that I want to add some sort of indicators :( but no luck ..

In fact, some comments will be appreciated at all Something special :)

Clear-host

  $ serverList = Go-contentC: \ RServerList.txt $ creds = get-certified task Build_Directories {foreach (IN $ s $) ServerList) {new item - itamype directory - path c: \ data \ $ s}} function xecute_eLogs {$ i = 1 foreach ($ s $ serverList) {impaired-command-pump User Name $ s -ScriptBlock {Get-EventLog - Login Security - Interface Type "Error", "Warning"} - Credential $ creds | Retrieve data from "$ c $" ($ serverList.Count) out-file "C: \ data \ $ s \ sysElogs.txt" write-progress -file "$ s" -To complete the payment ($ i + + * 100 / $ ServerList.Count)}} Build_Directories xecute_eLogs  

You Write-Progress

Here's an example:

  $ max = 25 for ($ i = 1; $ i -le $ max; $ i ++) {Write -progress -flexibility "maximum number of up to $ i $ max" `- full full ($ i * 100 / $ maximum) sleep-secs 1}  

Edit about the situation Consider the children.

This optimized for your script will look like this:

  $ i = 1 foreach (IN $ s $ serverList) {invoke-command -ComputerName $ S -ScriptBlock {Get -EventLog -LogName System-EntryType "Error", "Warning"} -Credentials $ creds | Out-file "C: \ data \ $ s \ sysElogs.txt is retrieving data from" write-progress-specialty "$ $ that is out of $ $ $ ($ serverList.Count)" -Part Full ($ I ++ * 100 / $ ServerList.Count) - Stats Running}  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -