Access SMB Files for C # Log

I am trying to make a simple log of files transferred via SMB.

This works with Windows 8 or higher:

var scope = new ManagementScope(@"\\.\root\Microsoft\Windows\SMB"); var query = new WqlEventQuery( @"SELECT * FROM __InstanceOperationEvent WITHIN 1 WHERE TargetInstance ISA 'MSFT_SmbOpenFile'" ); ManagementEventWatcher watcher = new ManagementEventWatcher(scope, query); watcher.EventArrived += new EventArrivedEventHandler(HandleEvent); watcher.Start(); .... 

But it does not work for windows 7 or lower. (Runtime Requirements)

Is there a similar solution compatible with at least Windows 7?

1º Change

This Windows 7 module seems to perform this task:

Computer management (I see this information on windows 7)

mmc.exe

2º Edit

To clarify the purpose. I am creating a DLP (data loss prevention) application . I need to track and register the files that can be accessed through shared access to Windows (user, file name), and ultimately block this access when the user asks for the file.

+5
source share

Source: https://habr.com/ru/post/1270285/


All Articles