Weekend Scripter: Creating a Sample Log File by Using PowerShell | Hey, Scripting Guy! Blog
You could persist the value of $i by reading the line count for the log file. The line count is a good way to tell how many records are in a log file. You can store the output from the Get-Content command in a variable. (Get-Content -TotalCount -1 -Path )...