Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Credentials and Launching Processes on Other Machines

Posted on 2004-08-31
12
Medium Priority
?
236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 2
12 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 2000 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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
 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

670 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