简体   繁体   中英

Retrieve list of partitions/directories/folders/files from remote PC using C#

I am trying to develop a Windows based desktop software where I want to list all accessible partitions/directories/folders/files located on a remote PC within the same network. I have successfully programmed as how to retrieve the remote PC by IP/Name in a list [Dropdown/Combobox as we know]. Next once I select a particular remote PC, I need to retrieve the partitions/directories/folders/files on that remote PC and show them on may be grid view or a custom WPF control.

Note: I directly fetched list of PC accessible across the same network simply by IP/Name, I would also like to know if I could get meta information for each PC as which Operating System does it run on [ie Microsoft Windows 8 Pro or Mac OSX 10 or Ubuntu 13.04 Server] and what architecture [ie x64 or x86].

Note: The remote PC can be running any OS from any vendor ie Microsoft, Apple, Linux.

Note: Though it may not be possible to fetch list of all partitions/directories/folders/files from MacOSX or Linux based machines other than Shared folders, I would like to know as how to get list of folders/files those that are shared on MacOSX or Linux based PC.

This SO question suggests how to enumerate remote shares. This applies to Windows computers and should work with Linux/OS X with Samba shares. I don't know how you enumerate remote NFS/AFP shares using C#.

To retrieve directories/files you need permissions to access files on the share. You can then scan it like you would scan the local filesystem. This should work with all technologies.

Listing disk partitions requires access to WMI on the remote computer (Windows). I don't know how you enumerate partitions remote on Linux and OS X except using ssh or similar remoting application.

Extracting the OS version is OS specific. Again, not sure how you do this remote with Linux and OS X (for example nmap uses TCP/IP stack fingerprinting to identify remote machines, which can be defeated )

I'm not sure what you need this for, but I strongly suggest you install a standard and well tested monitoring system instead of trying to roll your own.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM