Hello!
I am trying to perfect this script to monitor if a text entry exists within a file on a remote host. If the Text exists, I want the monitor to turn red, and if the text cannot be found, I would like the monitor to remain green in up status.
Please Review, all suggestions welcome.
Get-Content -Path \\IP\D$\Deploy\Solarwinds\TestFolder\FileTest.txt
if Get-Content -Path \\IP\D$\Deploy\Solarwinds\TestFolder\FileTest.txt -like "May the Force be with you"
{
Write-Host "Message: Exists"
Write-Host "Statistic: 1"
Exit 1
}
else
{
Write-Host "Message: Does Not Exist"
Write-Host "Statistic: 0"
Exit 0
}