7 Replies Latest reply on Sep 12, 2008 1:17 PM by zman

    Compiled script.exe works locally but fails when pushed

    Apprentice

      A simple compiled AutoIT script that reads a registry key and is to write the results out to a text file works just fine when locally executed, but when pushed as an exe package will not work.  What am I missing?

       

       

      Extract of key script components:

      =============================

      #comments-start
         
          Check Novell Version.au3
         
          Check the version of the Novell Client for Windows installed.
          If less than the current version, write a log file of the PC and version number.
          Why this way?  LANDesk shows "Unknown" on the version when queried,

      but a direct regread gets the info.


          AutoIT version 3 script

       

      #comments-end

      ;    Initialization of variables:
      $ShortVersion = ""
      $CurrentVersion = 4.91
      $file0 = ""
      $file1 = ""
      $file2 = ""
      $PC = ""
      $NovellRegistryKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Novell"

      ; Get the PC Name:
      $PC = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "Hostname")
      ; Alternate Key: $PC = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName", "ComputerName")

      ; Check for the simple version number:
      $ShortVersion = RegRead( $NovellRegistryKey, "CurrentVersion")

      If $ShortVersion = "" Then
          ; MsgBox(0, "Novell Client Version", "Novell Registry Key " & $NovellRegistryKey & " Does Not Exist", 5)
          ; Open output file to record PC name and old version number:
          $file0 = FileOpen("\\adfs1\shared\DPI-WIDE\SHORTERM\CheckNovellClient-NoKey.txt", 1) ; open for append
         
          ; Check if file opened for reading OK
          If $file0 = -1 Then
              ; MsgBox(0, "Error", "Unable to open log file.",10)
              Exit
          Else ; Write the PC number and message into a text file for analysis later:
              FileWriteLine($file0, $PC & " " & "Novell Registry Key " & $NovellRegistryKey & " Does Not Exist" & @CRLF)
          EndIf

          FileClose($file0)
         
      Else

          If $ShortVersion <> $CurrentVersion Then ; If the installed version is different than current, log it:
              ; Open output file to record PC name and old version number:
              $file1 = FileOpen("\\adfs1\shared\DPI-WIDE\SHORTERM\CheckNovellClient-NotCurrent.txt", 1) ; open for append
             
              ; Check if file opened for reading OK
              If $file1 = -1 Then
                  ; MsgBox(0, "Error", "Unable to open log file.",10)
                  Exit
              Else ; Write the PC number and version number into a text file for analysis later:
                  FileWriteLine($file1, $PC & " " & $ShortVersion & @CRLF)
              EndIf

              FileClose($file1)

          Else ; Version is current, so log it to a different file, just to see what we get:
              ;    Open output file to record PCs and current or higher versions:
              $file2 = FileOpen("\\adfs1\shared\DPI-WIDE\SHORTERM\CheckNovellClient-Current.txt", 1) ; open for append
             
              ; Check if file opened for reading OK
              If $file2 = -1 Then
                  ; MsgBox(0, "Error", "Unable to open log file.",10)
                  Exit
              Else ; Write the PC number and version number into a text file for analysis later:
                  FileWriteLine($file2, $PC & " " & $ShortVersion & @CRLF)
              EndIf

              FileClose($file2)
          EndIf
      EndIf

      Exit

      =====================