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
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. Only you can retrieve the metadata (FileName, Date, Size) of the files using the CIM_DataFile
or you can 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