Uploaded image for project: 'JS - JobScheduler'
  1. JS - JobScheduler
  2. JS-1720

Exception when executing a powershell job on a Windows machine with default Ansi Code Page=UTF

    XMLWordPrintable

    Details

      Description

      Current Situation

      When a powershell job is started on a windows machine that has default Ansi Code Page=UTF the job ends with exit code=1

      The message
      [ERROR SCHEDULER-360 Error when accessing database table SCHEDULER_HISTORY [COM-8007007A The data area passed to a system call is too small. [WideCharToMultiByte]]] can be seen in the task log.

      Desired Behaviour

      No error should be thrown when a job is executed on a window system with default Ansi Code Page=UTF

      Workaround

      set current culture to InvariantCulture

      $culture = [System.Globalization.CultureInfo]::InvariantCulture
      [System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture
      [System.Threading.Thread]::CurrentThread.CurrentCulture = $culture

      Sample:

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <job order="no" stop_on_error="no" tasks="1" title="powershell job" process_class="/agent">
          <script  language="powershell">
          <![CDATA[$culture = [System.Globalization.CultureInfo]::InvariantCulture
      [System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture
      [System.Threading.Thread]::CurrentThread.CurrentCulture = $culture
      
      $culture
      dir
      ]]>
              </script>
      
          <run_time>
          </run_time>
      </job> 
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                re Robert Ehrlich
                Reporter:
                ur Uwe Risse
                Approver:
                Uwe Risse
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: