whorsfall
asked on
Powershell - Show progress with import-csv
Hi,
Is there any way when importing a CSV file via powershel (import-csv) l i can display the progress via the
write-progress cmdlet.
Thanks,
Ward
Is there any way when importing a CSV file via powershel (import-csv) l i can display the progress via the
write-progress cmdlet.
Thanks,
Ward
ASKER
Hi,
Thanks for that. Um not really this code give progress after the csv has been imported. I am after during.
Thanks,
Ward
Thanks for that. Um not really this code give progress after the csv has been imported. I am after during.
Thanks,
Ward
There's no real way to display progress for this. You could display something like which line number it is on, but to display something like a percent complete, you need to know what the end point is, and you don't know that until you've read in the entire file, so it's a chicken and the egg problem. Here's an example of displaying the line number.
Import-CSV file.csv | % -begin {$i=0} -process { Write-Progress -activity "Importing file" -currentOperation "Reading line $i" -PercentComplete -1; $i++ }
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://mrhodes.net/category/powershell/
About halfway down the page under the heading "Adding 285 Contoso Users with Pictures to your Development Environment Active Directory"