A
auldh
hello,
i have been playing around with this code and i'm not getting. i'm calling
"win32_process" to get a remote machine's process and owner. i try this
locally and i'm not having problems.
however when i to the remote machine i'm not able to get a valid returne for
"getowner". below is part of the code:
ConnectionOptions connectoptions = new ConnectionOptions();
connectoptions.Username = XHF.defInst.tUser.Text;
connectoptions.Password = XHF.defInst.mtPassword.Text;
connectoptions.Authority = "ntlmdomain:" + XHF.defInst.tDomain.Text;
connectoptions.EnablePrivileges = true;
ManagementScope scope = new ManagementScope(@"\\" + remoteSystem +
@"\root\cimv2", connectoptions);
scope.Connect();
//ManagementScope scope = new ManagementScope(@"\root\cimv2");
SelectQuery query = new SelectQuery("SELECT Name, Handle, CSName,
ParentProcessId, ProcessId, SessionId, ExecutablePath FROM Win32_Process");
XHF.defInst.xprhotfixviewer.Refresh();
using (ManagementObjectSearcher searcher = new
ManagementObjectSearcher(scope, query))
{
iNumberofProcess = searcher.Get().Count;
foreach (ManagementObject process in searcher.Get())
{
aProcess[iProcess, 0] = process["Name"].ToString();
aProcess[iProcess, 1] = process["Handle"].ToString();
aProcess[iProcess, 2] = process["CSName"].ToString();
aProcess[iProcess, 3] = process["ParentProcessId"].ToString();
aProcess[iProcess, 4] = process["ProcessId"].ToString();
aProcess[iProcess, 5] = process["SessionId"].ToString();
if (process["ExecutablePath"] != null)
aProcess[iProcess, 6] = process["ExecutablePath"].ToString();
else
aProcess[iProcess, 6] = "";
string[] methodArgs = { "", "" };
process.InvokeMethod("GetOwner", methodArgs);
i always return a null. i tried some sample on the internet and have yet to
crack the problem.
i have been playing around with this code and i'm not getting. i'm calling
"win32_process" to get a remote machine's process and owner. i try this
locally and i'm not having problems.
however when i to the remote machine i'm not able to get a valid returne for
"getowner". below is part of the code:
ConnectionOptions connectoptions = new ConnectionOptions();
connectoptions.Username = XHF.defInst.tUser.Text;
connectoptions.Password = XHF.defInst.mtPassword.Text;
connectoptions.Authority = "ntlmdomain:" + XHF.defInst.tDomain.Text;
connectoptions.EnablePrivileges = true;
ManagementScope scope = new ManagementScope(@"\\" + remoteSystem +
@"\root\cimv2", connectoptions);
scope.Connect();
//ManagementScope scope = new ManagementScope(@"\root\cimv2");
SelectQuery query = new SelectQuery("SELECT Name, Handle, CSName,
ParentProcessId, ProcessId, SessionId, ExecutablePath FROM Win32_Process");
XHF.defInst.xprhotfixviewer.Refresh();
using (ManagementObjectSearcher searcher = new
ManagementObjectSearcher(scope, query))
{
iNumberofProcess = searcher.Get().Count;
foreach (ManagementObject process in searcher.Get())
{
aProcess[iProcess, 0] = process["Name"].ToString();
aProcess[iProcess, 1] = process["Handle"].ToString();
aProcess[iProcess, 2] = process["CSName"].ToString();
aProcess[iProcess, 3] = process["ParentProcessId"].ToString();
aProcess[iProcess, 4] = process["ProcessId"].ToString();
aProcess[iProcess, 5] = process["SessionId"].ToString();
if (process["ExecutablePath"] != null)
aProcess[iProcess, 6] = process["ExecutablePath"].ToString();
else
aProcess[iProcess, 6] = "";
string[] methodArgs = { "", "" };
process.InvokeMethod("GetOwner", methodArgs);
i always return a null. i tried some sample on the internet and have yet to
crack the problem.