VB.NET 2005 - Monitor Folder Access In Windows XP
I'm trying to write a program that will monitor folder activity in windows xp. I would like to achieve the following...
1) Show which sub folders / files have been accessed
2) Show user detail / computer
3) date / time
I have looked at "filesystemwatcher" but that only works on windows 2000 / NT4.0. Any suggestions?
Re: VB.NET 2005 - Monitor Folder Access In Windows XP
What, the filesystemwatcher only works on Windows 2000/NT 4.0??
It's part of the framework so will work where the framework is installed.
http://msdn2.microsoft.com/en-us/lib...er(vs.80).aspx
Re: VB.NET 2005 - Monitor Folder Access In Windows XP
Cheers for the link. I was reading a whole bunch of other posts on different forums and code examples and it was mentioned that it would only work on Windows 2000 / NT 4.0. I now have it working on Windows XP but the only thing it is not telling me is when the folder / file was accessed.
Below is the code that I have used to monitor username and pc, but when accessed by a remote connection, the program only registers the local username / pc
Code:
lstEvents.Items.Add("Watcher detected some activity at " & _
Date.Now.ToString & " By " & GetCurrent.Name & " At WorkStation " & Environment.MachineName.ToString)
Re: VB.NET 2005 - Monitor Folder Access In Windows XP
Where are you getting GetCurrent.Name data? I don't see it as a common .net function.
And for getting Access time, use: IO.File.GetLastAccessTime("C:\test.txt")
Also, from more research it looks like the only reason it says the local username and machine is because thats what your code is looking for.
Re: VB.NET 2005 - Monitor Folder Access In Windows XP
He doesn't want to simply get the last access time of any file. He wants the fileSystemWatcher to raise the event of a change in the last access time of a file in a folder which is under watch which you can do by specifying it in the NotifyFilter property.
As for getting the info about the remote user I'm afraid I can't be of any help, maybe someone else will know or you could try a search or two on google and see if that has any luck.
Re: VB.NET 2005 - Monitor Folder Access In Windows XP
Quote:
Originally Posted by stimbo
He doesn't want to simply get the last access time of any file. He wants the fileSystemWatcher to raise the event of a change in the last access time of a file in a folder which is under watch which you can do by specifying it in the NotifyFilter property.
Of course, Im just saying after setting up the NotifyFilter, I would recommend using LastAccessTime to get the actual time/date when it's raised.
Re: VB.NET 2005 - Monitor Folder Access In Windows XP
Ive set the the NotifyFilters.LastAccess, but say for example when I open a text document in a folder which is under watch, nothing is logged. The only items that are showing are rename, delete, change, created.