Title: Win32::Job
A few things come to mind right off the bat, but I can't test them where I am right now.
 
First, even though the documentation for Win32::Job states that you can use forward slashes, you should try at least once using backslashes as directory separators.  There's always the possibility that the module is confused by the mixture of forward slashes for switches and forward slashes for directory separators.  It's a long shot, but you should check it out.
 
Secondly, you are listing CMD as the executable name and an argument.  I'm not sure what you're trying to accomplish here, or if it was just one of the things you were trying while you were trying to get it to work, but according to the docs you should use undef as the executable if you want to put the name of the executable in the argument list.
 
Thirdly, the documentation doesn't specify what the return value of a sucessful process is, so it's possible that it returns the exit code for that process, in which case a "TRUE" value would actually indicate an error, since programs generally return 0 on success.  In either case, if you want to check the status of a process, you should use the status() function from the module, which will probably give you a better idea of how your processes ended.
 
Finally, I'm not sure that Win32::Job is what you want to do this.  Even if you get this to work, I think all you would accomplish would be to run the version of cmd.exe that is on $workstion on YOUR computer, as if you opened it in Explorer and double-clicked on it, which is not what you want.  I would recommend checking out Win32::TaskScheduler as a pretty decent way of running processes on a remote machine.  The downside is that it won't be in real-time, and you will have to develop some other way of getting your reporting statistics other than harvesting the exit code directly.  Maybe someone else on the list has a better suggestion on that part.
 
 
 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Oliver Wayne E Contr AETC CSS/SCNS
Sent: Wednesday, March 10, 2004 8:10 AM
To: '[EMAIL PROTECTED]'
Subject: Win32::Job

All,
 I have a project to update some security settings on a few remote systems and would like to use Win32::Job to launch secedit. The encluded code is an example of what I am trying to do. It returns a success but fails to run the task. I don't know if I read the docs wrong or what. Could someone look over the code and offer any suggestions?

if ($job = Win32::Job->new)
                 {
                  print "$^E: Created initial job\n";
                  $myArgs =  'secedit /configure /db C:/WINNT/Security/Database/fortezzaFix.sdb /cfg C:/WINNT/Security/Templates/GCCS 3.7.1 Fortezza Fix.inf /log C:/WINNT/Security/Logs/fortezzaFix.log /verbose';

                  if ($job->spawn("//$workstation/ADMIN\$/System32/Cmd.exe", qq{cmd /C $myArgs}))
                    {
                    print "$^E: Maby it worked: \n";
                    } else {
                    print Win32::FormatMessage(Win32::GetLastError()) . "Failed to launch \n";
                    print qq{cmd /C $myArgs};
                    }
                 }
              
              } else {
              print "$workstation not available\n";
              }

 

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to