Discussion:
Starting an app remotely using WMI
(too old to reply)
v***@gmail.com
2009-02-18 05:41:05 UTC
Permalink
Hi

Can anyone assist me in how to start an application on a remote
machine using WMI.
I can execute the app if it situated on my local machine.

Any assitace would by higherly appreciated.

Thanks

Vimal
Gerry Hickman
2009-02-18 22:32:59 UTC
Permalink
Hi,

You have to be more clear.

If this "app" is an interactive GUI app then you won't like WMI. If it's
a totally silent console app and you don't care about the exit code and
you have remote admin rights to the target machine, then you may be OK.
Post by v***@gmail.com
Hi
Can anyone assist me in how to start an application on a remote
machine using WMI.
I can execute the app if it situated on my local machine.
Any assitace would by higherly appreciated.
Thanks
Vimal
--
Gerry Hickman (London UK)
Vimal
2009-02-19 05:02:37 UTC
Permalink
Post by Gerry Hickman
Hi,
You have to be more clear.
If this "app" is an interactive GUI app then you won't like WMI. If it's
a totally silent console app and you don't care about the exit code and
you have remote admin rights to the target machine, then you may be OK.
Post by v***@gmail.com
Hi
Can anyone assist me in how to start an application on a remote
machine using WMI.
I can execute the app if it situated on my local machine.
Any assitace would by higherly appreciated.
Thanks
Vimal
--
Gerry Hickman (London UK)
HI

Thank you for you response.
It is a console application.
Vimal
2009-02-19 10:33:46 UTC
Permalink
Post by Vimal
Post by Gerry Hickman
Hi,
You have to be more clear.
If this "app" is an interactive GUI app then you won't like WMI. If it's
a totally silent console app and you don't care about the exit code and
you have remote admin rights to the target machine, then you may be OK.
Post by v***@gmail.com
Hi
Can anyone assist me in how to start an application on a remote
machine using WMI.
I can execute the app if it situated on my local machine.
Any assitace would by higherly appreciated.
Thanks
Vimal
--
Gerry Hickman (London UK)
HI
Thank you for you response.
It is a console application.- Hide quoted text -
- Show quoted text -
This is the snippet of code i use to establish a connection

public void CreateRemoteConnection()
{
try
{
//Create connection to remote computer
ConnectionOptions options = new ConnectionOptions();

options.Impersonation =
ImpersonationLevel.Impersonate;

options.EnablePrivileges = true;

_Scope = new ManagementScope("\\192.168.41.58\root
\cimv2", options);
_Scope.Connect();
}
catch (Exception ex)
{
throw new Exception(String.Format("WMI exception:
{0}", ex.Message));
}
}

The error i get is RPC server is not available
Gerry Hickman
2009-02-19 21:21:31 UTC
Permalink
Hi,
Post by Vimal
_Scope = new ManagementScope("\\192.168.41.58\root
\cimv2", options);
_Scope.Connect();
The error i get is RPC server is not available
If this is C#, you may need to double all back slashes in the connection
string.

It's also best to test the connection using WbemTest.exe first. Once
you've done that, you can copy the EXE to the remote machine and then
use Win32_Process.Create() to start it.
--
Gerry Hickman (London UK)
Vimal
2009-02-23 10:38:23 UTC
Permalink
Post by Gerry Hickman
Hi,
                _Scope = new ManagementScope("\\192.168.41.58\root
\cimv2", options);
                _Scope.Connect();
The error i get is RPC server is not available
If this is C#, you may need to double all back slashes in the connection
string.
It's also best to test the connection using WbemTest.exe first. Once
you've done that, you can copy the EXE to the remote machine and then
use Win32_Process.Create() to start it.
--
Gerry Hickman (London UK)
Hi

I now can get WMI to work but im now faced with a new error
(RPC_E_WRONG_THREAD ).
Im using ImpersonationLevel.Delegate becuase of the hops that is
required.
Do you know anything about this.

Thank you

Vimal
Gerry Hickman
2009-02-25 21:38:37 UTC
Permalink
Hi,

If you're using delegation you need to set it up properly in AD. You may
need to read up on how to do that, it's not something I've used.
Post by Vimal
Post by Gerry Hickman
Hi,
Post by Vimal
_Scope = new ManagementScope("\\192.168.41.58\root
\cimv2", options);
_Scope.Connect();
The error i get is RPC server is not available
If this is C#, you may need to double all back slashes in the connection
string.
It's also best to test the connection using WbemTest.exe first. Once
you've done that, you can copy the EXE to the remote machine and then
use Win32_Process.Create() to start it.
--
Gerry Hickman (London UK)
Hi
I now can get WMI to work but im now faced with a new error
(RPC_E_WRONG_THREAD ).
Im using ImpersonationLevel.Delegate becuase of the hops that is
required.
Do you know anything about this.
Thank you
Vimal
--
Gerry Hickman (London UK)
Loading...