title: Monitoring files for changes, but only changes to the content (not last modified date)?
body: <p>I have tinkered with a small script that monitors a folder and alerts if there is a change with that folder. Here is what I have so far: </p>
  
  <pre><code>$folder = 'folder\to\monitor' 
  
  $fsw = New-Object IO.FileSystemWatcher $folder, $filter -Property @{IncludeSubdirectories = $true;NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'}
  
  Register-ObjectEvent $fsw Changed -SourceIdentifier FileChanged1 -Action { 
  $path = $Event.SourceEventArgs.FullPath 
  $changeType = $Event.SourceEventArgs.ChangeType 
  $timeStamp = $Event.TimeGenerated 
  $datestamp = get-date -uformat "%Y-%m-%d@%H-%M-%S" 
  $Computer = get-content env:computername 
  $Body = " $path on $Computer was $changeType at $timeStamp" 
  $PIECES=$path.split("\") 
  $newfolder=$PIECES[-2] 
  Out-File -FilePath c:\Scripts\config_changes.txt -Append -InputObject " $path on $Computer was $changeType at $timeStamp" 
  Send-MailMessage -To "email@domain.com" -From "email@domain.com" -Subject $Body -SmtpServer "192.168.#.##" -Body " " 
  #Copy-Item $path "c:\scripts\versions\$newfolder" 
  #Rename-Item "c:\Scripts\Versions\$newfolder\web.config" "web.config-$datestamp" 
  #Remove-Item -path "c:\Scripts\Versions\$newfolder\web.config" -force}
  
  # To stop the monitoring, run the following commands: 
  # Unregister-Event FileChanged1
  </code></pre>
  
  <p>However, I am wanting to make the "criteria" for a file change a little more specific. From what research I've done, the FileSystemWatcher.Notify filter limits me to File Name, Last Write, etc. What I would like to do is check to see if any changes have been made to the <em>content</em> of the file. If none of the content has changed, then I don't want it to alert. </p>
  
  <p>The file constantly gets overwritten, even if there are no changes, so the modified date continues to change even if there is no content change.  </p>