Solved

Credentials and Launching Processes on Other Machines

Posted on 2004-08-31
12
233 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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
 

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why this code doesn't work? 8 108
mixing C++ and C code elegantly 10 158
Problem to save 10 174
Why is compiler in oracle server ? 9 75
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
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 and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.

828 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