Solved

Credentials and Launching Processes on Other Machines

Posted on 2004-08-31
12
231 Views
Last Modified: 2010-04-15
I've been researching for some time the methods available to run processes on other machines. WMI CreateProcess is one and the AT command scheduler is another and I have so far put those into practice with good results.

Sysinternals have wrapped it up nicely in their PSEXEC tool but I need to be able to do this programmatically and I don't know what API calls or os features they used to achieve remote execution.

Has anyone come across methods (other than WMI or AT) available for launching processes on other machines and I would be particularly interested in solutions which allow the passing of credentials so we're not just running under the "system" account.

thanks
0
Comment
Question by:plq
  • 5
  • 5
  • 2
12 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 11942536
PsExec basically uses the SCM API 'CreateService()' and 'StartService()' to install a service on the remote machine and execute arbitrary programs by connecting to that service which provicdes named pipes. See http://www.ntkernel.com/articles/psexec.shtml

0
 
LVL 86

Expert Comment

by:jkr
ID: 11942552
Oh, addressing the 'credentials'  part - that is implicitly done by creating the service to run under a specific user account.
0
 
LVL 8

Author Comment

by:plq
ID: 11942651
Hi jkr,

Yes I'm just reading that article. Must admit I'm more than a bit disappointed that they actually make changes to the remote machine (adding a service), although presumably they add a service, run the program and then remove the server so there's no permanent damage. Still if the thing fails halfway through presumably the end user is left with this service installed and started on their machine at least until the next reboot.

I'm going to research this further. I'm also thinking of looking at RPC - is that a way to launch a program remotely ?
0
 
LVL 86

Expert Comment

by:jkr
ID: 11942813
>>I'm also thinking of looking at RPC - is that a way to launch a program remotely ?

Yes, but that also requires starting a server process on the remote machine that launches the program in question and provides means to communicate with that program.
0
 
LVL 86

Expert Comment

by:jkr
ID: 11942825
BTW, see 'RPCExec' (http://www.listsoft.com/programs/202/) - that app does it via RPC
0
 
LVL 8

Author Comment

by:plq
ID: 11943508
Just one more question. Is RPC able to remote call a windows API function (like createprocess) on the client, or can you only create activex objects ?

In my case the program in question will be resident server share

so I will be doing createprocess on

\\comptuername\share\myfile.exe <params>

The program is for systems management so no need for a user interface and indeed this particular one only writes a single file back to the share (its a null session share)
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 86

Expert Comment

by:jkr
ID: 11943875
No, using RPC, all you can do is provide a server that calls 'CreateProcess()' on your behalf, but you cannot call any APIs directly. Also, RPC and ActiveX are not really related.
0
 
LVL 8

Author Comment

by:plq
ID: 11946167
OK thanks jkr.
0
 

Expert Comment

by:gswitz
ID: 12433334
strComputer = "ServerName"
path="d:\test\temp"

Set objSwbemLocator = CreateObject("WbemScripting.SwbemLocator")
Set objSwbemService = objSwbemLocator.ConnectServer(strcomputer, "root\cimv2", "ServerName\test", "test")
Set objfolder = objSwbemService.Get("Cim_Directory.name='" & path & "'")
objFolder.delete
0
 
LVL 8

Author Comment

by:plq
ID: 12433348
Whats that ?
0
 

Expert Comment

by:gswitz
ID: 12433677
0
 
LVL 8

Author Comment

by:plq
ID: 12433767
Thanks, but jkr answered the question perfectly, and the question did request solutions other than WMI or AT, which I already knew about.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now