Monitor filesystem and generate MD5 checksums

by matt_will_fix_it at 2013-02-07 16:55:46


I’m new to powershell but very eager to learn. I’m trying to create a script to monitor the filesystem for changes and then generate MD5 checksums of any changed files. I’ve found online articles which detail how to perform this in powershell, but I’m having trouble getting them to work together.

Monitor file system changes … owershell/

And use that output to generate checksums … files.aspx … ashes.aspx

I’ve come up with this script, but it doesn’t seem to generate any file hashes. Is there something I’m doing wrong or missing? If I change the line with the get-hash cmdlet to use write-host instead, I can see modified files.

Import-Module Pscx -RequiredVersion
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = “c:\temp”
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true

$changed = Register-ObjectEvent $watcher “Changed” -Action {
get-hash -Path $eventArgs.FullPath }
by DonJ at 2013-02-08 06:44:49
This appears to be similar to your thread at viewtopic.php?f=2&t=1216. Could you please ask all of your questions on that thread?

Also, make sure you try contacting the author of the script you’re trying to use. They’d be the best ones to help.
by matt_will_fix_it at 2013-02-08 13:49:55

I would like to ask all questions in one thread :slight_smile: This thread I posted very early in the day and it was held back for moderation. Then later in the day I posted the other thread (as I had no thread to add to) which was posted immediately… then this thread was approved by the moderators, however I had already fixed my problem :slight_smile:

Anyway, The issue I was having described above is now fixed. Thanks.