Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Capture cmdlet progress bars

$
0
0

Well, you should be able to prevent the default progress bars from popping up by setting the $ProgressPreference variable to SilentlyContinue. However, getting the data into your own form would depend on how you are executing the PowerShell code. If you're executing code using the System.Management.Automation.PowerShell class, then it's easy; you have access to the Progress stream, and can bind listeners to its DataAdded event (PowerShell.Streams.Progress.DataAdded; see http://msdn.microsoft.com/en-us/library/system.management.automation.psdatastreams.progress(v=vs.85).aspx and http://msdn.microsoft.com/en-us/library/dd144531(v=vs.85).aspx.

If you're just executing a script in powershell.exe, and building your own forms from there, I'm not sure how you'd intercept those ProgressRecords, off the top of my head.


Viewing all articles
Browse latest Browse all 13067

Trending Articles