Folder creation and Deletion logs (Proof)

~OSD~ 2,201 Reputation points
2023-08-29T12:33:39.4733333+00:00

Hi,

I have a folder as D:\MyFavoriteDirectory.

I would like to get the time stamps of when this directory was created and when it was deleted. Is it possible to achieve this in VB.Net of PowerShell?

Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Client for IT Pros | User experience | Other
Developer technologies | VB
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 47,901 Reputation points
    2023-08-29T21:31:40.28+00:00

    These attributes of files and directorys are available: CreationTime, LastAccessTime, and LastWriteTime

    But once an item is deleted there's no longer any record of it. That's just the way the file system works. So, not so much a PowerShell thing. :-)

    You can, however, enable auditing of actions in security policies (either GPOs or Local).

    If you running Windows 10 or 11 the machine isn't a domain member, run SecPol.msc. You'll find the Audit File System in the Advanced Audit Policy Configuration -> System Audit Policies -> Object Access. You can choose to audit success or failure. Then open the properties of the file system directory and "Advanced". Select the Audit tab and add what you want to audit.

    After that you can periodically look for the appropriate events in the security log. Just keep in mind that the security log can fill up pretty fast, and if you don't record when a directory/file was created there's no way to retrieve that information if the log file's been overwritten.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Castorix31 90,686 Reputation points
    2023-08-30T08:58:11.1133333+00:00
    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.