Sign in to follow this  
Followers 0
GreatWest

Error: Unable to execute the external program

11 posts in this topic

I have a script that's running from a GPO. This script runs two exteranl programs (one written in AutoIT and the second a Dell utility (exe)). All worked fine until two days ago. Now I get a pop up window that says -

Line 0 (File "\\server\autoAMS\AMSSQL_V1.exe:):

Run("\\server\autoAMS\readbios.exe >> C:\CSS.ini","",@SW_HIDE)

Error: Unable to execute the external program.

The paramter is incorrect.

Here's what happens - a user logs onto the domain. A GPO fires off and calls a VB script named "launch.vbs". The VB script calls AMSSQL_V1.exe which is located on our server. AMSSQL deletes a file on the laptop hard drive, runs a AutoIT compiled script called CSSini.exe. This script completes correctly. There's a built in delay (sleep) and then the script calls the readbios.exe program. This program was not written in AutoIT. The program pipes the data into the file that was created by the CSSini.exe. Up until two days ago this has been working flawlessly for almost two years. Now I receive the above noted error. This only happens when a user logs into the domain and the GPO fires off the routine. If I go directly to the server and and run "launch.vbs" directly then everything works perfectly. This of course makes trouble shooting next to impossible. Here's the portion of the script that errors out (of course 'server' = our server's name, removed here from the script).

; Script Start

#Include <process.au3>

#Include <Date.au3>

; Delete CSS.ini file

FileDelete("C:\CSS.ini")

; Run the CSSini.exe program which create the initial CSSini.file and puts the headers in the file. The CSSini.exe program is run hidden from the user.

RunWait("\\server\autoams\CSSini.exe","", @SW_HIDE)

; Sleep to allow the time for the data to be written to a file on the C: drive of the users computer.

Sleep (1000)

; Run the readbios.exe file and append the data to the CSS.ini file. Run this program hidden too.

RunWait("\\server\autoAMS\readbios.exe >> C:\CSS.ini","", @SW_HIDE)

As mentioned this worked for almost two years without an issue. I've contacted our security team and AD team to see if anything has changed. They say no, nothing in the permissions has changed. I've moved the entire script to a local server and pointed everything in that direction - no joy, still fails in the exact same place with the same error. I'm still not sure why I can run this if I go directly to the server and double click on the VB script. I remember having this same issue with another external call to a program a very long time ago. I just can't remeber how I fixed it.

Any suggestions as to why this all of a sudden is happening and what may resolve it, please feel free to suggest.

Thanks,

GW

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try specifying a Working Directory for your Run() Function.

Run("\\server\autoAMS\readbios.exe >> C:\CSS.ini",@WorkingDir,@SW_HIDE)
Edited by big_daddy

Share this post


Link to post
Share on other sites

Why is it that the popup says:

Run("\\server\autoAMS\readbios.exe >> C:\CSS.ini","",@SW_HIDE)

And your source says:

RunWait("\\server\autoAMS\readbios.exe >> C:\CSS.ini","", @SW_HIDE)

That's pretty interesting.


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

Why is it that the popup says:

Run("\\server\autoAMS\readbios.exe >> C:\CSS.ini","",@SW_HIDE)

And your source says:

RunWait("\\server\autoAMS\readbios.exe >> C:\CSS.ini","", @SW_HIDE)

That's pretty interesting.

Simply because I'm trying other options. The same issue happens with Run or RunWait.

GW

Share this post


Link to post
Share on other sites

Don;t think you can Pipe the stdout without running comspec...try:

RunWait(@comspec & " /c \\server\autoAMS\readbios.exe >> C:\CSS.ini","", @SW_HIDE)

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#include <Constants.au3>

$exepath = "\\server\autoAMS\readbios.exe"

If FileExists($exepath) Then
    $foo = Run($exepath, @SystemDir, @SW_HIDE, $STDOUT_CHILD)
    $output = ""
    While 1
        $output &= StdoutRead($foo)
        If @error Then ExitLoop
    Wend
    FileDelete("C:\CSS.ini")
    FileWrite("C:\CSS.ini",$output)
Else
    MsgBox(16,"Error", $exepath & " can not be found! Please contact support!")
EndIf


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

Try specifying a Working Directory for your Run() Function.

Run("\\server\autoAMS\readbios.exe >> C:\CSS.ini",@WorkingDir,@SW_HIDE)
You hit it on the head. I never had to put the working directory in before so I didn't even try that. The really strange part is that the area where the error was occuring I never touched. Really strange but I'm not questioning it now that it's working. Thanks for the pointer!

GW

Share this post


Link to post
Share on other sites

Don;t think you can Pipe the stdout without running comspec...try:

RunWait(@comspec & " /c \\server\autoAMS\readbios.exe >> C:\CSS.ini","", @SW_HIDE)
Actually yes it will work both ways. Remember I mentioned this has been running for almost two years this way without error. I'm still not sure why the error just magically showed up but big_daddy pointed me in the right direction. Thanks for responding though.

GW

Share this post


Link to post
Share on other sites

#include <Constants.au3>

$exepath = "\\server\autoAMS\readbios.exe"

If FileExists($exepath) Then
    $foo = Run($exepath, @SystemDir, @SW_HIDE, $STDOUT_CHILD)
    $output = ""
    While 1
        $output &= StdoutRead($foo)
        If @error Then ExitLoop
    Wend
    FileDelete("C:\CSS.ini")
    FileWrite("C:\CSS.ini",$output)
Else
    MsgBox(16,"Error", $exepath & " can not be found! Please contact support!")
EndIf
Thanks lod3n - much cleaner and I need to clean up my code one of these days when I have time. For now it's working and I don't touch things that work!

GW

Share this post


Link to post
Share on other sites

Also, this might be of interest:

; Generated by AutoIt Scriptomatic

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output = $Output & "Computer: " & $strComputer  & @CRLF
$Output = $Output & "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output = $Output & "Caption: " & $objItem.Caption & @CRLF
      $Output = $Output & "Description: " & $objItem.Description & @CRLF
      $Output = $Output & "IdentifyingNumber: " & $objItem.IdentifyingNumber & @CRLF
      $Output = $Output & "Name: " & $objItem.Name & @CRLF
      $Output = $Output & "SKUNumber: " & $objItem.SKUNumber & @CRLF
      $Output = $Output & "UUID: " & $objItem.UUID & @CRLF
      $Output = $Output & "Vendor: " & $objItem.Vendor & @CRLF
      $Output = $Output & "Version: " & $objItem.Version & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ComputerSystemProduct" )
Endif


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

You hit it on the head. I never had to put the working directory in before so I didn't even try that. The really strange part is that the area where the error was occuring I never touched. Really strange but I'm not questioning it now that it's working. Thanks for the pointer!

GW

Your welcome.

This was one of the first support questions I ever asked!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0