Script for notification of new files in network folder(s)

25 pts.
Tags:
Microsoft Exchange
Scripting
Windows scripting
Windows Server 2003
Hi, Does anyone know of a script to notify specific individuals on a network that a network folder has received a new file? The notification can be via email (exchange) or text to phone. Thanks

Software/Hardware used:
exchange, windows 2003 server

Answer Wiki

Thanks. We'll let you know when a new response is added.

try this – uses PowerShell 2.0

function eventhandler {
param ($e)
Write-Host “File: $($e.SourceEventArgs.FullPath) has arrived”
}

$folder = “C:\test”
$filter = “*”
$fsw = New-Object -TypeName System.IO.FileSystemWatcher -ArgumentList $folder, $filter
$fsw.IncludeSubDirectories = $true

$action = {eventhandler $($event)}

Register-ObjectEvent -InputObject $fsw -EventName “Created” -SourceIdentifier “File System Creation” -Action $action

You can replace the line that starts Write-Host

with

send-mailmessage and the appropriate parameters

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following