8 Replies Latest reply on Feb 14, 2012 6:36 AM by Jose Antonio

    Run Perl script



      I need to run a Perl script on a Windows virtual machine. This virtual machine is a vCenter, which has the vCLI installed (so, I'm able to run a Perl script directly in the Windows virtual machine).


      But from BladeLogic Server Automation Console 8.1, using: "scriptutil -h ??TARGET.NAME?? -s //....../Script.pl", I get this error: ""C:/tmp/...Script.pl" is not a valid Win32 application. See the client log file for more details." By the way: the script runs OK if I run it inside the vCenter.


      Any ideas?

      I need to run perl scripts on the Windows virtual machine, because I'm trying to check compliance rules against a lot of ESXi hosts, which are only managed through vCenter.


      Thank you very much.

        • 1. Re: Run Perl script



          My bad, I thought your requirement is to execute Perl script as NSH job,

          I think you have got two good suggestions below by Adam and Gbartoccini





          • 2. Re: Run Perl script

            try this instead (I am assuming you are trying to do this as an EO):


            Remote execution:

            nexec ??TARGET.NAME?? perl //....../Script.pl

            • 3. Re: Run Perl script
              Gerardo Bartoccini

              Or even this


              nexec ??TARGET.NAME?? cmd /C perl c:\your_path_in_windows_style_possibly_with_double_back_slashes\Script.pl

              • 4. Re: Run Perl script

                First of all, thank you for your answers.


                The Perl script is stored in the BladeLogic server, not in the Windows machine. So, the idea is to run the Perl script against the Windows machine directly from the BladeLogic server, without copying it before to that machine.


                So, I think I have to use the runscript/runcmd option, not the nexec one, don't I?


                BTW, Adam: yes, I'm trying to execute it as an Extended Object.


                Thank you.

                • 5. Run Perl script
                  Niranjay Bharati

                  Jose , As you mentioned that it is a perl script & you have used scriptutil command for the same ,

                  It looks like the below error states that the target machine against which you are running the perl scipt does not have perl interpreter or if it has then is not recognized as win32 application ,



                  I get this error: ""C:/tmp/...Script.pl" is not a valid Win32 application.



                  Does your script contains shebang statement in the begining which specifies path to perl interpreter on target?

                  • 6. Run Perl script



                    Thank you for your help.


                    The target machine has a Perl interpreter. In fact, I can run any Perl script stored in that machine, and it works right.

                    That machine has the path to the Perl interpreter configured, so I can execute a Perl script from any source path without specifying the interpreter path.

                    • 7. Re: Run Perl script
                      Bill Robinson

                      I believe scriptutil will only handle batch files on windows – you may want try runscript.

                      • 8. Run Perl script



                        I've tried runscript, scriptutil... And every sort of combinations of them with Central/Remote execution. But I've had no success...


                        So I'm making NSH scripts that copy the Perl script to the target machine, and it works.


                        If I get some success with the question I'll post it.


                        Thank you.