Kaseya Community

Get Variable -- File Content not working as expected.

  • Hi, used Get Variable specifying File Content then emailing the results before and had it work successfully. This time however the result is only the first character of the log file that I'm reading.

    I'm running a script to uninstall WordPerfect 12 which seems to work ok but I've got to check the msiexec.exe log file to verify that the uninstaller ran ok. I'm reading this log file as using Get Variable -- File Content then specifying the log file and full path. On my test machines I know WordPerfect is uninstalling properly because I can manually check this log file and it is all there. But, when I use the Kaseya script to email the contents of that file it only has one character in the body of the email, usually the letter M which is the first letter in the file. I've inserted 2 pauses in the script to see if msiexec was late in writing the file but it doesn't seem to matter.

    Any ideas?

    Here's the script:

    Script Name: WordPerfect12 Dell OEM Uninstall
    Script Description: Executes MSIEXEC.EXE to uninstall WP 12 OEM by Dell. Emails contents of msiexec log file to support@itsou.com.

    IF True
    THEN
    Get Variable
    Parameter 1 : 6
    Parameter 2 :
    Parameter 3 : machinename
    OS Type : 0
    Get Variable
    Parameter 1 : 10
    Parameter 2 :
    Parameter 3 : tempdir
    OS Type : 0
    Execute Shell Command
    Parameter 1 : msiexec.exe /qn /x {AF19F291-F22F-4798-9662-525305AE9E48} /L #tempdir#\wpsetup.log
    Parameter 2 : 0
    OS Type : 0
    Pause Script
    Parameter 1 : 240
    OS Type : 0
    Get Variable
    Parameter 1 : 1
    Parameter 2 : #tempdir#\wpsetup.log
    Parameter 3 : msiresult
    OS Type : 0
    Pause Script
    Parameter 1 : 30
    OS Type : 0
    Send Email
    Parameter 1 : support@itsou.com
    Parameter 2 : Dell WP 12 OEM Uninstall Result for #machinename#
    Parameter 3 : #msiresult#
    OS Type : 0
    Write Script Log Entry
    Parameter 1 : Dell WP 12 OEM Uninstall Succeeded -- See email for result.
    OS Type : 0
    ELSE
    Write Script Log Entry
    Parameter 1 : Dell WP 12 OEM Uninstall Script Failed
    OS Type : 0

    Thanks.

    Nick
    nickb@itsou.com

    Legacy Forum Name: Get Variable -- File Content not working as expected.,
    Legacy Posted By Username: nickb
  • Nevermind...found this on the support site:

    CAUSE
    The text file specified by the File Contents parameters is a unicode file. Get Variable > File Contents does not currently support Unicode encoding.

    RESOLUTION
    To workaround the issue, include a step that Executes Shell command of the following form:

    type c:\temp\oldfile.txt >> c:\temp\newfile.txt

    Then Get Variable > File Contents the output file (in this example newfile.txt).

    The "type" command handles unicode input and outputs ANSI text.


    MORE INFORMATION
    Development are working on a fix for this issue, which will be included in a future release of Kaseya.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: nickb