Results 1 to 7 of 7

Thread: VB.NET 2005 - Monitor Folder Access In Windows XP

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question 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?

  2. #2
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    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
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question 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)

  4. #4
    Hyperactive Member
    Join Date
    Sep 2005
    Location
    Alaska
    Posts
    435

    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.

  5. #5
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    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.
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  6. #6
    Hyperactive Member
    Join Date
    Sep 2005
    Location
    Alaska
    Posts
    435

    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.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    111

    Question 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width