Search and get file information from remote workstation on a Windows domain
I need to query the file system of a remote workstation on a Windows domain. The program should search the remote file system for the existence of specific filenames and file paths. For example, assume I want to find out whether “c:program filesmozillafirefox.exe” or “c:program fileschromechrome.exe” exists on any workstation in a domain of 10,000 machines.
What options I know: 1) Only C# code with windows impersonation using WIN32 API and using UNC path with Admin Share access like ServerNameC$FolderName.(I am not sure that we need to run the app from domain server to get workstation Admin Share access).
2) Using WMI with C# Management classes, get remote system access with Domain Admin credentials impersonation, then use query(s) to get the remote file information.
I have implemented both scenarios, but I am not sure which one best and performs well on real time. I have only tested with 2-3 systems network available with me.
I have questions in my mind.
1) Which option is best suits for the situation? 2) Which one is faster, safer and consistent?
Please suggest me one of those or any best option available for above requirement.
Thank You, Ravi
No need to run this from a domain controller. With proper privs, you can run WMI queries from anywhere. In fact, pushing them to a DC would add a hop to the query and likely be slower than querying directly. If you have domain admin privs for the process, I'd just query directly to the unc path for the file existence check, and be done with it.
链接地址: http://www.djcxy.com/p/44172.html上一篇: 通过指定凭证访问服务器上的文件