For a quick project I'm working on in VB.Net I want to track when users have accessed a file. Example:
testfile.txt exists on a drive. When a user opens or edits the file, I wish to record what time and who edited it.
I've been able to use the FileSystemWatcher to determine when the file is edited, etc, but I'm trying to work out how to determine what user accessed it.
As far as programming goes its only really a hobby for me so any help would be much appreciated.
Checking what user has accessed a file (.Net)
Moderator: Thanas
- Ace Pace
- Hardware Lover
- Posts: 8456
- Joined: 2002-07-07 03:04am
- Location: Wasting time instead of money
- Contact:
Probably relies on event logging of security events being enabled, but pull the event log and work backwards, whats the last user that logged on.
I'm pretty sure .Net has capability for that, I could look up MSDN for you.
Another method is probably getting the active user from the shell, this should be possible, though probably by importing another DLL.
I'm pretty sure .Net has capability for that, I could look up MSDN for you.
Another method is probably getting the active user from the shell, this should be possible, though probably by importing another DLL.
Brotherhood of the Bear | HAB | Mess | SDnet archivist |
Enable audit logging (local security policy) and then enable audit logging in on the files in question.
This will record accesses to various things, will generate a double-wide metric fuckton of eventlogs.
This will record accesses to various things, will generate a double-wide metric fuckton of eventlogs.
"Okay, I'll have the truth with a side order of clarity." ~ Dr. Daniel Jackson.
"Reality has a well-known liberal bias." ~ Stephen Colbert
"One Drive, One Partition, the One True Path" ~ ars technica forums - warrens - on hhd partitioning schemes.
"Reality has a well-known liberal bias." ~ Stephen Colbert
"One Drive, One Partition, the One True Path" ~ ars technica forums - warrens - on hhd partitioning schemes.