Direct Inward Dialing: +1 408 916 9892
Be it confidential customer information or critical resource's configuration files, change monitoring helps to maintain the integrity of these data. Many tools including native Windows PowerShell can help you perform folder change monitoring. However, it isn't easy to come up with scripts and perform this task without a glitch. An easy way to monitor the changes to files and folders is through AD auditing solution like ADAudit Plus.
The following is a comparison between monitoring a folder for file changes with Windows PowerShell and ADAudit Plus:
$folder = 'c:\powershell\test'
$filter = '*.*'
$fsw = New-Object IO.FileSystemWatcher $folder, $filter -Property @{IncludeSubdirectories = $true;NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'}
Register-ObjectEvent $fsw Created -SourceIdentifier FileCreated -Action {
$name =
$Event.SourceEventArgs.Name
$changeType =
$Event.SourceEventArgs.ChangeType
$timeStamp =
$Event.TimeGenerated
Write-Host "The file '$name' was $changeType at $timeStamp" -fore green
Out-File -FilePath c:\scripts\filechange\outlog.txt -Append -InputObject "The file '$name' was $changeType at $timeStamp"}
Register-ObjectEvent $fsw Deleted -SourceIdentifier FileDeleted -Action {
$name = $Event.SourceEventArgs.Name
$changeType = $Event.SourceEventArgs.ChangeType
$timeStamp = $Event.TimeGenerated
Write-Host "The file '$name' was $changeType at $timeStamp" -fore red
Out-File -FilePath c:\scripts\filechange\outlog.txt -Append -InputObject "The file '$name' was $changeType at $timeStamp"}
Register-ObjectEvent $fsw Changed -SourceIdentifier FileChanged -Action {
$name = $Event.SourceEventArgs.Name
$changeType = $Event.SourceEventArgs.ChangeType
$timeStamp = $Event.TimeGenerated
Write-Host "The file '$name' was $changeType at $timeStamp" -fore white
Out-File -FilePath c:\scripts\filechange\outlog.csv -Append -InputObject "The file '$name' was $changeType at $timeStamp"}
The details you will find in this report are:
The following are the limitations of using Windows PowerShell to monitor a folder for changes:-
ADAudit Plus on the other hand will swiftly generate reports by scanning all the DCs and these reports can be exported in multiple formats.