Who is Accessing Your System ?

This is quite interesting to know that who is accessing your shared folder in network. We can easily get the information of that user and even you can track what is the activity he is doing in your system. We can achieve this using WMI (Windows Management Instrumentation) and MQL ( Management Query Language ) .

For using WMI you need to add one DLL called System.Management.dll and add the namespace as

using System.Management

Now Read the current Session of your system.

private  void Read_Current_Session()
        {
           try
            {
                ManagementObjectSearcher searcher =
                   new ManagementObjectSearcher("root\\CIMV2",
                   "SELECT * FROM Win32_ServerConnection");
                foreach (ManagementObject queryObj in searcher.Get())
                {
                   String RemoteIPAddress = queryObj["ComputerName"].ToString();
                   String RemoteUserName = queryObj["UserName"].ToString();
                   String  RemoteActiveTime = queryObj["ActiveTime"].ToString();
                }
            }
            catch (ManagementException e)
            {
               MessageBox.Show("WMI Error: " + e.Message);
            }
        }

Few Years back I have developed one Open Source Tool (NetSpY) based on WMI and MQL. NetSpy (NetWorkSpy) is an Small Windows based application which will continiouly monitor your shared folder in the network and will generate the complete log of the accessing user activities. This can show you the immidiate popup message that who is accessing right now.

If you are interested please have a look over here,
Net Spy: Your Network Spy That Monitor Your System In Network And Generate Log For Any Changes

Advertisements

Written by Abhijit Jana

I am a Modern and Cloud App Development Consultant working at Microsoft. Presently I am focusing on adopting and delivering world class solution on N+1 Technologies, where I mainly drive engagements on Universal Windows Platforms, Microsoft Azure, IoT and Cross Platform and Device related application Development. I am a former Microsoft MVP, Author of Kinect for Windows SDK and HoloLens BluePrints book and Run Daily .NET Tips . To know more about me click here.

2 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s