• twitter

  • Advertisements

Send an email alert if a file is created that contains a certain string

So, download yourself the File Watcher Simple

Click New

Give the Daemon a name, and have it watch say the c:\Test

I only needed ‘File or folder created’ checked and the event is File name

Under process Tab I just type powershell

Check box the ‘Start process when file system change is detected’

And I used c:\test as the process working directory

Under Process arguments:

file watcher simple

c:\test.ps1 %1

And Process arguments file name escape string:


and check box the Use file name as argument

So what does our little test.ps1 powershell file look like

$SearchString = “string”
$PSEmailServer = “mailserver”
$Sel = select-string -pattern $SearchString -path $FileName
If ($Sel -eq $null)
echo “Not Found”
echo “Found”
Send-MailMessage -to “” -from “<>” -Subject “found” -body “found”


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: