Read remote file without file sharing
I'm trying to read a file on a remote computer howeve开发者_运维知识库r, ports for file sharing are blocked. Actually most porst are closed and only have access to execute WMI and Registry queries.
Is it possible to read or pull data from a remote server using WMI or the registry?
The WMI doesn't allow read the content of any local or remote fil. Instead provides a set classes to list, copy, rename, compress and get info about files and directories. These classes are CIM_DataFile
, CIM_Directory
and Win32_Directory
. If you want to see a sample of how use these classes check this article Manipulating local/remote files and folders using Delphi and WMI
which I wrote some time ago.
There's another possibility, created by Frank White a few months ago using this "cmd /c echo ..." approach:
strCommand = "cmd /c echo myTextCommands > c:\temp\testscript.txt"
To see a fully-fleshed out VBScript, see my solution here
精彩评论