Windows Partition Monitoring

I am trying to control connections to a Windows share using C #, I am sure that this is possible, since you can see people connected to you from the Windows console manager.

Although I am not opposed to a solution using WMI, I would prefer to use an alternative method.

What I mean by connections is when someone opens up sharing on a PC monitor or a file is shared.

+3
source share
2 answers

I would suggest using WMI, as it is designed specifically for this purpose.

Here is the MSDN link for Win32 shares and WMI implementation:

Win32_Share Class - MSDN

+1
source

WMI .

WMI , , WMI. PowerShell ( "Docs$" ):

$p = (Get-WmiObject -Class Win32_Share -Filter 'Name="Docs$"').__PATH
Get-WmiObject -Query "Associators of {$p} WHERE ResultClass=Win32_ServerConnection" | Format-Table -auto ShareName, UserName,ComputerName,NumberOfFiles
0

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


All Articles