Trying to come up with a .ps1 that counts log files generated by Exchange (multiple DB's on multiple servers) on an as needed basis between backups. Input file is a .csv of the format:
Server,DBName
server1,exdb11
server1,exdb12
server2,exdb21
server2,exdb22
Here is what I thought should work but gives me "token 'in'" errors on the ForEach or is not accepting the input to determine the network path to the file locations.
$PathNames = (Import-csv C:\ExServerDBs.csv)
ForEach-Object ($P in $PathNames)
{
$ExDBLogPath = "\\" + $_.Server + "\d$\ExchangeLogs\" + $_.DBName
(Get-ChildItem -Path $ExDBLogPath -filter "*.log").Count
}
Any help insight or suggestions would be greatly appreciated.
Thanks!
KYPaul