简体   繁体   中英

Read/Write Remote File using WMI C#

I need to read and write(update) some remote machine file.I am able to find the remote file using WMI(System.Management) but not able to do read or updation on that.

Any help would be appreciated.

Thanks

Himanshu

The WMI doesn't have any class (or method) to read or write the content of files. You may only retrieve the metadata (FileName, Date, Size) of the files using CIM_DataFile , or do tasks like Copy , Rename , Delete or Compress files.

First check your file access in premmisions and set user "Everyone" to Full Control then try it again.完全访问

RRUZ is correct: WMI cannot copy or create files over a network. This is because it would require credential "hopping": http://msdn.microsoft.com/en-us/library/windows/desktop/aa389288%28v=vs.85%29.aspx

However, a workaround was recently created by Stackoverflow.com user Frank White in C#, and the WMI logic ports directly to VBS. Here's his solution: WMI remote process to copy file

I ported it to a fully working VBScript: https://stackoverflow.com/a/11948096/1569434

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