Dec 12 2018 01:05 AM
Hello, i´m new to Powershell and need some help.
I need to parse a logfile from a network licensemanager where 90% of the entries are denials. i wrote a script which works fine, but the time it needs is too much.
There are about 250k lines in the inputfile, at ~40k lines the time increments dramaticaly so that the time the script needs rise up to 30mins.
Someone have an idea how could i change my very simple code that it runs much faster?
Dec 17 2018 05:37 AM
Hello,
I would just filter the lines with a match and use the pipeline to write it out to a file.
This should be faster:
get-content "$Path\lmgrd.log" | Where-Object { if ($_ -notmatch "DENIED:") { $_ }} | Out-File ($path+$fileName)
Dec 18 2018 12:05 AM
Thanks, this solution works fine and much faster than my one.