R
ricolee99
Hi everyone,
I'm trying to invoke my .exe application from a remote server. Here is
the code:
ManagementClass processClass = new ManagementClass ("\\\\"
+"RemoteServerName"
+
"\\root\\CIMV2:Win32_Process");
//returns back an object that contains a list of input parameters for
the method
ManagementBaseObject inParams = processClass.GetMethodParameters
("Create");
//set the parameters
inParams ["CommandLine"] = "C:\\SomeFolder\\Startup.exe" + " \""
+
"C:\\SomeFolder\\someconfig.xml" + "\"";
InvokeMethodOptions options = new InvokeMethodOptions();
options.Timeout = new TimeSpan(0,0,0,30);
ManagementBaseObject outParams = processClass.InvokeMethod ("Create",
inParams,
options);
string return_code = outParams ["ReturnValue"].ToString();
When I run this, it runs under a valid domain account called:
someDomain/someAccount, I get a return code from the outParams
(return_code) of "8". Looking on msdn:
http://msdn.microsoft.com/library/d.../wmi/create_method_in_class_win32_process.asp
it tells me the value is "Unknown Failure".
I've tried many things, looking at permissions and finally the above
code to invoke my application successfully. I got it working by
granting someDomain/someAccount full administrator priviliges on the
remote machine and it worked like a charm.
The problem is my co. is not allowing me to grant this account admin
privileges on that machine. This doesn't make sense as it shouldn't
need admin access, as long as it has read/execute permissions on the
exe folder, winnt folder, and documents and settings folder on the
remote machine.
Can someone please tell me what the problem is? Why do I need
administrative access for that account on the remote server for it to
work?
Any suggestions would be much, much appreciated!
Thanks in advance
Sharon
I'm trying to invoke my .exe application from a remote server. Here is
the code:
ManagementClass processClass = new ManagementClass ("\\\\"
+"RemoteServerName"
+
"\\root\\CIMV2:Win32_Process");
//returns back an object that contains a list of input parameters for
the method
ManagementBaseObject inParams = processClass.GetMethodParameters
("Create");
//set the parameters
inParams ["CommandLine"] = "C:\\SomeFolder\\Startup.exe" + " \""
+
"C:\\SomeFolder\\someconfig.xml" + "\"";
InvokeMethodOptions options = new InvokeMethodOptions();
options.Timeout = new TimeSpan(0,0,0,30);
ManagementBaseObject outParams = processClass.InvokeMethod ("Create",
inParams,
options);
string return_code = outParams ["ReturnValue"].ToString();
When I run this, it runs under a valid domain account called:
someDomain/someAccount, I get a return code from the outParams
(return_code) of "8". Looking on msdn:
http://msdn.microsoft.com/library/d.../wmi/create_method_in_class_win32_process.asp
it tells me the value is "Unknown Failure".
I've tried many things, looking at permissions and finally the above
code to invoke my application successfully. I got it working by
granting someDomain/someAccount full administrator priviliges on the
remote machine and it worked like a charm.
The problem is my co. is not allowing me to grant this account admin
privileges on that machine. This doesn't make sense as it shouldn't
need admin access, as long as it has read/execute permissions on the
exe folder, winnt folder, and documents and settings folder on the
remote machine.
Can someone please tell me what the problem is? Why do I need
administrative access for that account on the remote server for it to
work?
Any suggestions would be much, much appreciated!
Thanks in advance
Sharon