joshlowit1
7 years agoNeophyte
Log Files
I have successfully created an alert for a log file. My question is, How do I monitor the log file regardless of drive letter? I monitor the same log file on several servers but on some of the serv...
Are you using PowerShell for this? If so, something like this should work
$logfileExists=0
if(test-path D:\path\to\logfile.txt)
{
$logfileExists=1
}
elseif(test-path E:\path\to\logfile.txt)
{
$logfileExists=1
}
else
{
$logfileExists=0
}
$outString="logfileExists="+$logfileExists
write-host $outString
Otherwise - you can run a command like this
$drives = GET-WMIOBJECT win32_logicaldisk | select DeviceID
foreach($drive in $drives)
{
#do a test-path to the path on each drive
}
Hope that helps.