c# - Retrieve process information and files from a remoted machine -



c# - Retrieve process information and files from a remoted machine -

i’m trying retrieve specific process using next code:

process[] process = process.getprocessesbyname(_processname, _ip);

when _ip “127.0.0.1”, process retrieved successfully. when _ip represents remote machine, next exception occurs:

system.invalidoperationexception occurred hresult=-2146233079 message=couldn't connect remote machine. source=system stacktrace: @ system.diagnostics.ntprocessmanager.getprocessinfos(string machinename, boolean isremotemachine) @ system.diagnostics.processmanager.getprocessinfos(string machinename) @ system.diagnostics.process.getprocesses(string machinename) @ system.diagnostics.process.getprocessesbyname(string processname, string machinename) @ toissimulator.toisresultscollector.collectresults() in d:\pi2\thirdparty\tcc_new\tccmediator\toissimulator\toisresultscollector.cs:line 101 innerexception: system.invalidoperationexception hresult=-2146233079 message=couldn't process info performance counter. source=system stacktrace: @ system.diagnostics.ntprocessmanager.getprocessinfos(performancecounterlib library) @ system.diagnostics.ntprocessmanager.getprocessinfos(string machinename, boolean isremotemachine) innerexception: system.componentmodel.win32exception hresult=-2147467259 message=access denied source=system errorcode=-2147467259 nativeerrorcode=5 stacktrace: @ system.diagnostics.performancemonitor.init() @ system.diagnostics.performancecounterlib.getperformancedata(string item) @ system.diagnostics.ntprocessmanager.getprocessinfos(performancecounterlib library) innerexception:

i tried following:

ping between 2 machine – succeeded

cancel firewall @ remote machine

enable , start “remote registry” service on both machines

the purpose of retrieving process find it’s directory path , read log files located in directory using next code line:

filestream fstream = new filestream(fileinfo.fullname, filemode.open, fileaccess.read, fileshare.readwrite);

hope have tried process info on remote computer . says right way have wmi.

this link has nice illustration this, uses system.management connect remote scheme , process details.

c# remote-access

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -