OzzyOsbourne has asked for the wisdom of the Perl Monks concerning the following question:

I have run win32::process from my local machine, calling an executable from the server, and it appears as a process on my local workstation and I can see the notepad window.

When I call win32::process from a CGI script, it creates a background process on the web server (no window) called notepad.exe.

Question 1 : Does win32::process only create processes on the boxes that they are run on (no calling processes to run on other boxes)?

Question 2 :Why was the server version background (i.e. no window) and the local run was not?

Win32::Process::Create($ProcessObj, '//server/winnt/notepad.exe', 'notepad //server/winnt/temp.txt', 0, CREATE_NEW_CONSOLE, ".")|| die ErrorReport();

Thanks for all your help...

-ozzyosbourne

Replies are listed 'Best First'.
(jcwren) RE: Where does Win32::process really run?
by jcwren (Prior) on Sep 14, 2000 at 23:28 UTC
    Win32::Process only creates processes on the local machine. When you run a web server, from Win32::Process's point of view, the web server is the local machine.

    There are calls to create processes on other machines, but it involves security cooperation, and a few other things. You *could* write a Win32::API set of calls to implement remote processing, or you can write a custom application that acts as a remote processor by using Soap, or something similiar.

    Windows supports Remote Procedure Calls as one method of process delegation. With this, you write stubs that do the processing you want, and bind them to the O/S. You can also set authentication levels, minimum or maximum load level requirements, and some other fun stuff. There's a *large* chapter about this in the MSDN stuff. As far as I know, and I haven't looked into this much, you can't just throw an arbitrary process to a machine to be run. There's all sorts of nasty things that can happen, that would make VBScript viruses look like a pleasant thing to have happen.

    The reason you don't see the notepad.exe window on the server, is because the web server does not have permission to interact with the desktop. There is a bit that can be set as to whether that's permitted or not for a background process. Most processes (DNS, web serving, etc) do not require the ability to display windows on the desktop. Since notepad.exe is a child process of the web server, the notepad.exe window does not show up on the desktop.

    --Chris

    e-mail jcwren
      Thanks a lot guys for helping me out...even I was looking out for a way to run a child process without the parent process having to wait....thanks for helping Harpreet