473,387 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

UserName of the use who last modified a file in Windows

I have been trying to find a way to get the Domain and UserName of the
user that last modified a file.
I know how to get the owner of the file via WMI or Win32, but I can't
find a way to get the name of the user that last modified it. Is this
possible? I am using C#.

Thanks.

Mar 2 '07 #1
9 59296
<ma*******@googlemail.comwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
>I have been trying to find a way to get the Domain and UserName of the
user that last modified a file.
I know how to get the owner of the file via WMI or Win32, but I can't
find a way to get the name of the user that last modified it. Is this
possible? I am using C#.

Thanks.

No, the system doesn't keep track of this, this is something you will have to do yourself.

Willy.

Mar 2 '07 #2
On 2 Mar, 12:04, "Willy Denoyette [MVP]" <willy.denoye...@telenet.be>
wrote:
<mazen....@googlemail.comwrote in message

news:11**********************@s48g2000cws.googlegr oups.com...
I have been trying to find a way to get the Domain andUserNameof the
user that lastmodifiedafile.
I know how to get the owner of thefilevia WMI or Win32, but I can't
find a way to get the name of the user that lastmodifiedit. Is this
possible? I am using C#.
Thanks.

No, the system doesn't keep track of this, this is something you will have to do yourself.

Willy.
Thanks Willy. This is quite rubbish. If windows is recording and
keeping track of the "Last Modified" time, why not record the identity
of the person that did the modification as well. I am quite surprised
at that.
Cheers,

Mar 2 '07 #3
<ma*******@googlemail.comwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
On 2 Mar, 12:04, "Willy Denoyette [MVP]" <willy.denoye...@telenet.be>
wrote:
><mazen....@googlemail.comwrote in message

news:11**********************@s48g2000cws.googleg roups.com...
>I have been trying to find a way to get the Domain andUserNameof the
user that lastmodifiedafile.
I know how to get the owner of thefilevia WMI or Win32, but I can't
find a way to get the name of the user that lastmodifiedit. Is this
possible? I am using C#.
Thanks.

No, the system doesn't keep track of this, this is something you will have to do
yourself.

Willy.

Thanks Willy. This is quite rubbish. If windows is recording and
keeping track of the "Last Modified" time, why not record the identity
of the person that did the modification as well. I am quite surprised
at that.
Cheers,
What you are asking is simply not possible, the costs of such generic book keeping is simply
too high. The system doesn't keep track of this for performance reasons, that's also why the
system only performs an access check at file "open" time and not for any IO following the
open.

Willy.

Mar 2 '07 #4
Hi,

<ma*******@googlemail.comwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
On 2 Mar, 12:04, "Willy Denoyette [MVP]" <willy.denoye...@telenet.be>
wrote:
><mazen....@googlemail.comwrote in message

news:11**********************@s48g2000cws.googleg roups.com...
>I have been trying to find a way to get the Domain andUserNameof the
user that lastmodifiedafile.
I know how to get the owner of thefilevia WMI or Win32, but I can't
find a way to get the name of the user that lastmodifiedit. Is this
possible? I am using C#.
Thanks.

No, the system doesn't keep track of this, this is something you will
have to do yourself.

Willy.

Thanks Willy. This is quite rubbish. If windows is recording and
keeping track of the "Last Modified" time, why not record the identity
of the person that did the modification as well. I am quite surprised
at that.
Cheers,
AFAIK this is true in all the OS, none record the user that modified the
file, just when the file was modified.
Mar 2 '07 #5
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in message
news:eI*************@TK2MSFTNGP06.phx.gbl...
Hi,

<ma*******@googlemail.comwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
>On 2 Mar, 12:04, "Willy Denoyette [MVP]" <willy.denoye...@telenet.be>
wrote:
>><mazen....@googlemail.comwrote in message

news:11**********************@s48g2000cws.google groups.com...

I have been trying to find a way to get the Domain andUserNameof the
user that lastmodifiedafile.
I know how to get the owner of thefilevia WMI or Win32, but I can't
find a way to get the name of the user that lastmodifiedit. Is this
possible? I am using C#.

Thanks.

No, the system doesn't keep track of this, this is something you will have to do
yourself.

Willy.

Thanks Willy. This is quite rubbish. If windows is recording and
keeping track of the "Last Modified" time, why not record the identity
of the person that did the modification as well. I am quite surprised
at that.
Cheers,

AFAIK this is true in all the OS, none record the user that modified the file, just when
the file was modified.
No, not even when the file was modified, the system performs an access check at file open
time by checking the user's access token. Once the user has an handle to the file, he can do
whatever is possible given his token, the system does not perform any further check from
this point on. Note also that the system doesn't update the "last modified" time for each
write, the "last modified" time is only updated at file closing time provide that this time
is equal to the "last modified " time + 1 minute.
Willy.

Mar 2 '07 #6
You *could* activate object access auditing and then try to trace the audit
events... The audititing system traces the user's SID and the object access.
For there you *COULD* in theory to find out who was the last SID
manipulating the file.

The audit event 567 can trace that:
"
A permission associated with a handle was used.
Note: A handle is created with certain granted permissions (Read, Write, and
so on). When the handle is used, up to one audit is generated for each of
the permissions that was used. "

More of it here and why it's not worth of it (I've tried it):

http://blogs.msdn.com/ericfitz/archi...07/545726.aspx

"Willy Denoyette [MVP]" <wi*************@telenet.beha scritto nel
messaggio news:OB**************@TK2MSFTNGP04.phx.gbl...
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:eI*************@TK2MSFTNGP06.phx.gbl...
>Hi,

<ma*******@googlemail.comwrote in message
news:11**********************@s48g2000cws.googleg roups.com...
>>On 2 Mar, 12:04, "Willy Denoyette [MVP]" <willy.denoye...@telenet.be>
wrote:
<mazen....@googlemail.comwrote in message

news:11**********************@s48g2000cws.googl egroups.com...

I have been trying to find a way to get the Domain andUserNameof the
user that lastmodifiedafile.
I know how to get the owner of thefilevia WMI or Win32, but I can't
find a way to get the name of the user that lastmodifiedit. Is this
possible? I am using C#.

Thanks.

No, the system doesn't keep track of this, this is something you will
have to do yourself.

Willy.

Thanks Willy. This is quite rubbish. If windows is recording and
keeping track of the "Last Modified" time, why not record the identity
of the person that did the modification as well. I am quite surprised
at that.
Cheers,

AFAIK this is true in all the OS, none record the user that modified the
file, just when the file was modified.

No, not even when the file was modified, the system performs an access
check at file open time by checking the user's access token. Once the user
has an handle to the file, he can do whatever is possible given his token,
the system does not perform any further check from this point on. Note
also that the system doesn't update the "last modified" time for each
write, the "last modified" time is only updated at file closing time
provide that this time is equal to the "last modified " time + 1 minute.
Willy.

Mar 2 '07 #7
"Laura T." <LT@NOWHERE.COMwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
You *could* activate object access auditing and then try to trace the audit events... The
audititing system traces the user's SID and the object access. For there you *COULD* in
theory to find out who was the last SID manipulating the file.

The audit event 567 can trace that:
"
A permission associated with a handle was used.
Note: A handle is created with certain granted permissions (Read, Write, and so on). When
the handle is used, up to one audit is generated for each of the permissions that was
used. "

More of it here and why it's not worth of it (I've tried it):

http://blogs.msdn.com/ericfitz/archi...07/545726.aspx

Agreed, that's something you can do on a restricted level, say per file basis or folder (by
activating the File auditing) depending on the systems activity (number of users number of
file accesses etc.), the problem is that the number of events can be so high, that the
security log fills very quickly. Also don't underestimate the performance impact of this,
especially on a servers, this kind of auditing is done to find illegal object attempts, not
really to audit success attempts.
Willy.

Mar 2 '07 #8
I agree. And I strongly advise to not use this method for general file
tracking.
A better way is to make a FS filter driver to track file usage. It's safer
and much faster.

"Willy Denoyette [MVP]" <wi*************@telenet.beha scritto nel
messaggio news:Oj**************@TK2MSFTNGP06.phx.gbl...
"Laura T." <LT@NOWHERE.COMwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
>You *could* activate object access auditing and then try to trace the
audit events... The audititing system traces the user's SID and the
object access. For there you *COULD* in theory to find out who was the
last SID manipulating the file.

The audit event 567 can trace that:
"
A permission associated with a handle was used.
Note: A handle is created with certain granted permissions (Read, Write,
and so on). When the handle is used, up to one audit is generated for
each of the permissions that was used. "

More of it here and why it's not worth of it (I've tried it):

http://blogs.msdn.com/ericfitz/archi...07/545726.aspx


Agreed, that's something you can do on a restricted level, say per file
basis or folder (by activating the File auditing) depending on the systems
activity (number of users number of file accesses etc.), the problem is
that the number of events can be so high, that the security log fills very
quickly. Also don't underestimate the performance impact of this,
especially on a servers, this kind of auditing is done to find illegal
object attempts, not really to audit success attempts.
Willy.

Mar 5 '07 #9
On 2 Mar, 16:30, "Willy Denoyette [MVP]" <willy.denoye...@telenet.be>
wrote:
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in messagenews:eI*************@TK2MSFTNGP06.phx.gbl.. .


Hi,
<mazen....@googlemail.comwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
On 2 Mar, 12:04, "Willy Denoyette [MVP]" <willy.denoye...@telenet.be>
wrote:
<mazen....@googlemail.comwrote in message
>>news:11**********************@s48g2000cws.google groups.com...
>I have been trying to find a way to get the Domain andUserNameof the
userthat lastmodifiedafile.
I know how to get the owner of thefilevia WMI or Win32, but I can't
find a way to get the name of theuserthat lastmodifiedit. Is this
possible? I am using C#.
Thanks.
>No, the system doesn't keep track of this, this is something you will have to do
yourself.
>Willy.
Thanks Willy. This is quite rubbish. If windows is recording and
keeping track of the "LastModified" time, why not record the identity
of the person that did the modification as well. I am quite surprised
at that.
Cheers,
AFAIK this is true in all the OS, none record theuserthatmodifiedthe file, just when
the file wasmodified.

No, not even when the file wasmodified, the system performs an access check at file open
time by checking theuser'saccess token. Once theuserhas an handle to the file, he can do
whatever is possible given his token, the system does not perform any further check from
this point on. Note also that the system doesn't update the "lastmodified" time for each
write, the "lastmodified" time is only updated at file closing time provide that this time
is equal to the "lastmodified" time + 1 minute.

Willy.- Hide quoted text -

- Show quoted text -
My point was that at the same time that windows is recording the "last
Modified" time, at closing or whenever its doing it, is to record the
user identity(Domain\user) at the same time. Not sure why this would
be such a masiv overhead!! But, I guess this is a design decision
since this effects performance per your comment above.
Thanks guys for all your input and information.
-Mazen

Mar 5 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rich Pasco | last post by:
The PERL statement I use to open a text file looks like this: open(HANDLE, $filename); Now how can I get the "last modified" date of that file? I need a solution that works the same under Windows...
1
by: Amanda | last post by:
Hi, hope you can help me with this one. If I want to get the date a page has been last modified, I can do something like .. document.write("<b>Last updated: "+document.lastModified+"</b>"); ...
11
by: Dennis Marks | last post by:
There seems to be a major program with the automatic display of the last modified date. Using the javascript "document.lastModified" sometimes returns the correct date and sometimes 1 Jan 1970...
7
by: laredotornado | last post by:
Hello, Does anyone know how (or if) I can figure out the last time a web page was last modified if my only access to it is via HTTP (a web browser). Right now, I'm looking at "Page Info" options....
6
by: SQLcat | last post by:
I have a VBScript as follows: Dim xmlHTTP : Set xmlHTTP = CreateObject("Microsoft.XMLHTTP") Dim adoStream : Set adoStream = CreateObject("adodb.stream") Const bGetAsAsync = False ' wait for...
3
by: RAMohrmann | last post by:
Greetings, I am attempting to view all files in a directory and if those files have not been modified within the last couple days I will remove them. In order to do this I need to look at the...
1
by: Svetac | last post by:
Hi, I use a script that shows when the page was last modified. It works fine for just one html file. The thing I would like to do is that the script shows me of last modified file in root...
3
by: Gretsch | last post by:
Web, html, javascript, Hi, I need to calculate the time since this .htm file was last modified. {which I can then use in a calculation, rather than display, so days&decimals format would be OK}...
3
by: sklamp | last post by:
Hello evryone I hope, that I corectly placed this question. For example: I have a folder with name "yName" and this folder includes binary files, like "Testing.ov", which cames from simulation. When...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.