Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Credentials and Launching Processes on Other Machines

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
plq
Asked:
plq
  • 5
  • 5
  • 2
1 Solution
 
jkrCommented:
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
 
jkrCommented:
Oh, addressing the 'credentials'  part - that is implicitly done by creating the service to run under a specific user account.
0
 
plqAuthor Commented:
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
Independent Software Vendors: 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!

 
jkrCommented:
>>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
 
jkrCommented:
BTW, see 'RPCExec' (http://www.listsoft.com/programs/202/) - that app does it via RPC
0
 
plqAuthor Commented:
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
 
jkrCommented:
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
 
plqAuthor Commented:
OK thanks jkr.
0
 
gswitzCommented:
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
 
plqAuthor Commented:
Whats that ?
0
 
plqAuthor Commented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 5
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now