Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2011
    Posts
    9

    Default Scheduled script works if logged in but fails with Unable to load base folder if not.

    Hopefully an easy question but unfortunately the answer is proving elusive for me at present.
    Running BeyondCompare version 3.3.13 build 18981.

    The Setup
    I have a windows scheduled event set up to trigger X actions and shift files around before comparing them and emailing the results out. I put it together on a Server 2003 machine and it has been happy chugging along for several years, but the machine needs to be retired so I'm moving it to a new machine (Server 2012R2).

    In the old system it would run a bat file and call the following:
    "D:\Program Files\Beyond Compare 3\BCompare.exe" @"D:\Reports\Exe\BeyondCompare.txt"

    In the BeyondCompare.txt it contained the following:
    load ignore-unimportant-session
    criteria rules-based
    load "D:\Reports\Master Copy" "D:\Reports\Latest"
    expand all
    select all.diff.files
    text-report layout:side-by-side &
    options:ignore-unimportant,display-mismatches &
    output-to:"D:\Reports\Exe\Audit2.html" output-options:html-color

    folder-report layout:summary &
    options:display-mismatches output-to:"D:\Reports\Exe\Audit3.html" output-options:html-color

    In the new machine (Server 2012R2 and now attempting to use Powershell) it was called using:
    & "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe" "@`"D:\Reports\Exe\BeyondCompare.txt`"" | Write-output
    #(The Write-output was used to make it wait until it was done before proceeding to send out the email etc.)

    In the BeyondCompare.txt it contained exactly the as noted above (with the same folders/layout and share permissions as far as I can see).

    The results/problem
    If I manually run it, the completes without issue.
    If I schedule it and remain signed in when it triggers it finishes without issue.
    If I leave the schedule to run while I'm not signed in then it fails.
    After turning on logging (log normal "D:\Reports\BeyondCompareLogging.txt") I saw the following (ditto with verbose):

    27/04/2017 3:08:32 p.m. >> #Turn logging on.
    27/04/2017 3:08:32 p.m. >> log normal "D:\Reports\BeyondCompareLogging.txt"
    27/04/2017 3:08:32 p.m. >> load ignore-unimportant-session
    27/04/2017 3:08:32 p.m. Load comparison: <->
    27/04/2017 3:08:32 p.m. Fatal Scripting Error: Unable to load base folder
    27/04/2017 3:08:32 p.m. Script completed in 0.05 seconds

    However when I run it manually it completes without issue, and the same set-up (as far as I can tell) is still running/completing without issue on the old Server 2003 machine.

    If I comment out the #load ignore-unimportant-session line it completes, but the email is now huge (as there are quite a few rules about what can be ignored - though this has been set as default so could this be improved somehow on my part?)

    Things I've tried/checked:
    I tried altering "criteria rules-based" to include the "ignore-unimportant" e.g. criteria rules-based ignore-unimportant but I suspect this is an improvement that is only present/available for v4 as it seems to be disliked by v3.
    The scheduled event on both machines is the same and running as myself with my credentials and set to run even if no one is signed in. It has also been set to run with the highest privileges and the action written as PowerShell.exe -File "D:\Reports\Copy to Reports.ps1".
    I altered everything to use UNC pathing and shared relevant root parent folders etc.
    Tried calling it using more pure Powershell (after getting help from others):
    Write-Output "Running BeyondCompare"
    $process="${Env:ProgramFiles(x86)}\Beyond Compare 3\BCompare.exe"
    $args="@`"$targetDirectory\Exe\BeyondCompare.txt`" "
    Write-Output $process $args
    Start-Process $process -ArgumentList $args -Wait
    Write-Output "BeyondCompare has finished"
    I tried incorporating the ignore-unimportant option into:
    folder-report layout:summary &
    options:display-mismatches output-to:"D:\Reports\Exe\Audit3.html" output-options:html-color
    However I believe that is not an option in v3 (or v4 from a quick check).

    I keep coming back to the "load ignore-unimportant-session" line. Am I in the right area?
    Or could it be the different UAC on the newer OS?
    Any ideas where or what I've missed in the move?
    Fingers crossed it is something simple.
    Hopefully this isn't a duplicate (I looked but couldn't see anything which I've not already tried/experimented with).
    Thanks.
    Rob.

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    Hello,

    The failing line is loading a saved session, but sessions (and settings) are stored per Windows User account. What is very likely happening is the script is executing as a different Windows User than the graphical interface (each stores settings in their %AppData%\Scooter Software\Beyond Compare 3\).

    The quick fix, besides setting both to run as the same Windows account, is to create a Portable Install. A Portable Install, created from the Setup.exe, is a single directory install that stores all settings within itself, so any user running it (graphical or automated) shares the settings. It will need to be placed in a directory that has Read/Write access for any user (D:\Tools\Beyond Compare 3\ as an example). You can register it just like a normal install.
    Aaron P Scooter Software

  3. #3
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    I should add the new Portable won't have your saved settings/sessions, but you can launch your existing normal install, use the Tools menu -> Export, then launch and Tools -> Import in the new install to bring the existing settings over. Both will store separate settings, so you'll want to be sure of which graphical interface you are using (so not to modify the normal and expect script to pick up the changes).
    Aaron P Scooter Software

  4. #4
    Join Date
    Dec 2011
    Posts
    9

    Default

    Thanks Aaron,
    Setting up a Portable (as noted above) worked nicely (and it now works as expected while I'm not logged in).
    The original scheduled event was running using the same (my) Windows account (and highest privileges) plus the relevant session had been imported...but for some reason it still didn't want to run when I wasn't logged in, oh well I'll put it down to some variance due the newer Windows Security and ignorance on my part. I suspect sharing the Beyond Compare 3 folder might have also worked?
    Thanks again for your help,
    Rob.

  5. #5
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    Sharing the BC3 folder? Sorry, I'm not sure which you're referring to, but the error "failed to load base folder" was likely happening because the script user didn't have that session name in its saved sessions list. Sometimes we've seen issues running in specific environments even when configured to be the same user, hence the Portable Install alternate workaround. This information is stored in BCSessions.xml in the user's configuration directory (%AppData% for a normal install, or the program directory for a Portable install).
    Aaron P Scooter Software

  6. #6
    Join Date
    Dec 2011
    Posts
    9

    Default

    Sorry for the late reply.
    Thanks for the information, I was (incorrectly) hoping it was something relatively simple like sharing the %AppData% folder e.g. "C:\Users\User.Name\AppData\Roaming\Scooter Software\Beyond Compare 3" thus the scheduled task (which is running with my credential and should already have access to this folder) would see/access the scheduled sessions. However by putting a portable second version of BeyondCompare at "D:\Reports\Exe\BeyondCompare\Beyond Compare 3" has nicely got around the problem. Thanks!

    I suspect new rules added/updated for the default BC will not flow though and be applied for the second portable version? Thus users would need to export them from the default version then import them into the portable each time?

    Would it be safer to uninstall the default BC version and instead using the portable version (to hopefully remove the possibility of mismatches). Other than losing the explorer integration are there any other limitations?

    Or can I edit/point the default BC version to use sessions stored in a UNC or shared location rather than the %AppData% location? (Thus everyone uses, sees, edits the same sessions).

    Sorry for the extra questions, overall I'm really pleased it is working and the above queries are relatively minor (to hopefully prevent it being inadvertently broken by others in the future). If you prefer to close this issue then that wouldn't be an issue. Thanks again.
    Rob.

  7. #7
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    Hello,

    Theoretically, if running the scheduled task as the same Windows User account (Defined as part of the task) then the Portable isn't necessary and that user's settings should be used. This can be tricky to set up in some environments based on how the script is run, however, so the Portable Install is a quick/easy workaround.

    And correct, the normal install and portable install on the same system do not transfer settings between each other. If a BCState.xml is in the program directory, then that becomes a single directory install that only looks/generates files within that folder.

    In the BC3 Tools menu -> Options dialog, General section, you can define a Shared Sessions file in a shared location to share settings. However, if the normal installs aren't able to access the User's %AppData%, I'm not sure if this file would be accessible during your script call; you'd have to test.

    And no problem about extra questions. Let us know how the above tests/trials go for you; we can get this working smoothly.
    Aaron P Scooter Software

  8. #8
    Join Date
    Dec 2011
    Posts
    9

    Default

    Hi Aaron,
    Thanks again for the help. Sharing Sessions sadly did not do the trick for me. I'm not sure what I've set up incorrectly (but I agree it might have something to do with the Windows User account (a Domain account user vs. a local Admin user account - although they shouldn't make a difference, as it works when I'm signed in)). Either way it isn't the end of the world and sadly time pressure is pulling me away to another project. With your help, the Portable version producing the expected comparison and working nicely (I'll simply leave extra notes explaining to other users on the machine to update the separate version for the scheduled comparison).
    Thanks again for all your help.
    Regards,
    Rob.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •