|
Hi,
I created a new account on the remote server and gave it Admin priviledges.
I am trying to execute an exe using this new account and it comes back with Access is Denied.
Is this something to do with this newly created account?
Thanks so much!
|
|
|
|
|
You haven't specified HOW you're trying to launch this .EXE and what this has to do with WMI.
|
|
|
|
|
ConnectionOptions opts = new ConnectionOptions();
opts.Username = "my_username"
opts.Password = "my_pwd";
ManagementPath path = new ManagementPath(@"\\<myserver>\root\cimv2:Win32_Process");
ManagementScope scope = new ManagementScope(path, opts);
scope.Connect();
ObjectGetOptions getopts = new ObjectGetOptions();
ManagementClass mgClass = new ManagementClass(scope, path, getopts);
ManagementBaseObject inParams = mgClass.GetMethodParameters("Create");
//Fill in input parameter values
inParams["CommandLine"] = @"\\<myprogramlocation>\myprogram.exe";
//Execute the method
ManagementBaseObject outParams = mgClass.InvokeMethod("Create", inParams, null);
|
|
|
|
|
It is an account issue, the account set up on the remote server needs to be a domain account. An account specific to that computer is not working.
|
|
|
|
|
It doesn't need to be a domain account...
It just needs to be an account that your code knows about and can pass credentials for.
|
|
|
|
|
You get Access Denied because the account your code is running under does not have permissions to the remote machine. By default, if you don't specify any account information in the Management connection objects, it'll use the account your code is running under. If that account doesn't have permissions on the remote machine, it'll fail.
|
|
|
|