![]() I'm not really concerned about the Error Event, but left it on the list for reference purposes. Occurs when a file or directory in the specified Path is renamed. Occurs when the instance of FileSystemWatcher is unable to continue monitoring changes or when the internal buffer overflows. Occurs when a file or directory in the specified Path is deleted. Occurs when a file or directory in the specified Path is created. ![]() Occurs when a file or directory in the specified Path is changed. We have the following Events available to use: Name I'm mostly concerned about the Events in this instance. Looking at the members of the FileSystemWatcher object. $FileSystemWatcher | Get-Member -Type Properties,Event Figure 1. $FileSystemWatcher = New-Object System.IO.FileSystemWatcher The Events are the key to understanding how we can use this for monitoring using Register-ObjectEvent. Let's take a look at the FileSystemWatcher object and examine both its properties and events that are available. I also mentioned that this could be used in conjunction with a Dropbox folder that could run as a consumer and handle various files dumped into the folder. Now before you start thinking that we might have an amazing monitoring solution that can provide who did what to what, the type of data returned is minimal such as listing the name of the item as well as the previous name if it was renamed. Using the FileSystemWatcher class, we can set up a listener against a folder and its subfolders while specifying narrow scopes of what we are looking to watch such as whether the file/folder was created or deleted as well as if the ACL on the objects have been changed. While this would certainly work, there is another way to accomplish this that provides a more real time approach as using the FileSystemWatcher class. ![]() a baseline file such as a CSV or XML file. You could have a scheduled task configured that could run against a folder after so many minutes and compare the contents vs. Whether it is monitoring for files and folders being updated in a specific location or you want to set up a sort of Dropbox to dump files in, the options for doing any sort of monitoring against a folder (or subfolders) are very slim.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |