I know that this is probably really easy but I am drawing a blank on how to accomplish it. Here is what I have:
$dir = "\\BHC\D$\PDX\Logs\Threshold Manager_*_*.log"
$latest = Get-ChildItem -Path $dir | Sort-Object LastAccessTime -Descending | Select-Object -First 1
$latest.name
$Content = Get-Content -Path $latest | Where {$_.Contains("\\BHC\Server\Bytes Total/sec")}
Basically if the file contains the text "\\BHC\Server\Bytes Total/sec" I want to output the number "540" to a variable so that I can use it to reference content in a SQL database. I know how to reference the DB already...
Thanks in advance for your help!