Announcement

Collapse
No announcement yet.

Error running script when HS4 run as a service (Windows)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Error running script when HS4 run as a service (Windows)

    I use task scheduler to start HS4 on boot:
    Click image for larger version  Name:	Screenshot (1).png Views:	0 Size:	88.4 KB ID:	1443717
    This works fine for the most part, however discovered a very specific issue with running scripts. This error does not occur, when HS4 is run using the desktop shortcut, from the same user's desktop as configured above:
    Click image for larger version  Name:	Screenshot (8).png Views:	0 Size:	383.3 KB ID:	1443718

    The script (any of my scripts), which itself contain no calls to this .dll, returns this error:

    Error
    Compiling script EvansPhone.vb: compiler initialization failed unexpectedly: The system cannot find the file specified.
    12/28/2020 3:03:06 PM
    HomeSeer
    Error
    Compiling script EvansPhone.vb: could not find library 'Scheduler.dll'
    12/28/2020 3:03:06 PM
    HomeSeer
    Event
    Running script in background (Security System - Sensor Breach -> Activate Alarm): EvansPhone.vb("Main","ALARM")
    12/28/2020 3:03:06 PM



    My initial thoughts when I noticed the scripts weren't running, was that it was something permissions related with the script itself, but after finding this, am now left looking elsewhere for answers..

    #2
    It very well might be related to permissions. Looks like you could be starting HS before a user is logged in. Credentials are attached to the logged in user and might effect your ability to access some files. I start HS similarly, but instead of at startup, I run it when anyone logs in.
    tenholde

    Comment


      #3
      Change the task to 'Run only when user is logged on' and auto-login the user.
      Of course, there are security issues with such a setup but it works.

      Comment


        #4
        Did you set the "Start in (optional)" field under the "Start a Program" action? You should set it to the HS3 directory.

        Comment


          #5
          UPDATED -- 6) ACTIONS TAB


          I was able to get this working on my Windows 7 Laptop (this should also work in Windows 10).

          Some takeaways from this setup:
          a) Create a local account on the Computer and make sure they are a member of the Administrator (LOCAL ADMIN) Group on the computer.
          b) Remember to follow each step in order, and exactly.
          c) There may be a way to set this up to run as a SERVICE in Windows (still investigating).

          Here is what I did:

          1) Go to the USER ACCESS CONTROL settings and make the following changes:

          Click image for larger version  Name:	UAC_Settings.png Views:	0 Size:	204.2 KB ID:	1445344


          2) Next go to the TASK SCHEDULER and [ Run As Administrator ] (Always - even if making a change) - This even if you are already using an account with "Local Admin" rights.

          3) Use the CREATE TASK option (this allows for a walk-through / wizard type building of the task):

          Click image for larger version  Name:	TashSched_1.png Views:	0 Size:	371.7 KB ID:	1445345


          4) GENERAL TAB -- Use the following settings (you can call it what you want - and whatever description you want):

          Click image for larger version  Name:	TashSched_2.png Views:	0 Size:	11.1 KB ID:	1445346
          *** Make sure that you use the CHANGE USER OR GROUP to choose the 'Local User' you created to run the task.


          5) TRIGGERS TAB -- Make sure you are using the following settings (specifically the USER you created for running HomeSeer).:

          Click image for larger version  Name:	TashSched_3.png Views:	0 Size:	10.7 KB ID:	1445347


          6) ACTIONS TAB -- See Settings below - point to the location where HS4.exe is installed: ** NOTE: I did some testing, some of the Plug-Ins would not run unless you add the START IN folder (WITHOUT QUOTES) - you will get a Scheduler.dll error.

          Click image for larger version  Name:	TashSched_4.png Views:	0 Size:	18.9 KB ID:	1445400


          7) CONDITIONS TAB -- No Settings are set:

          Click image for larger version  Name:	TashSched_5.png Views:	0 Size:	16.0 KB ID:	1445349


          8) SETTINGS TAB - I used the settings below:

          Click image for larger version  Name:	TashSched_6.png Views:	0 Size:	10.9 KB ID:	1445350

          9) SAVE the Task - and verify that you can see it in the list of TASKS. If you are logged in as the user you setup in the task - you can MANUALLY run it after closing HS4 - it should start the application back up. If not - LOGOFF the PC and login with the user you created - see if the TASKS starts automatically.


          Below are the steps to set the PC to AUTO-MAGICALLY login with a user. This will basically, with the steps above set your PC to boot from a power failure or any other restart task, LOGIN and LAUNCH HOMESEER.

          1) Press “Win” + “R” key at the same time to open “Run” window. Type in: netplwiz, click “OK”.

          2) In “User Accounts” window, select the target user that needs to automatically sign in Windows 7.

          3) Uncheck the option “Users must enter a user name and password to use this computer”. Then click “OK”.

          Click image for larger version  Name:	Auto_Login.png Views:	0 Size:	14.0 KB ID:	1445351

          4) When “Automatically sign in” window pops up, type password and click “OK”. This user account will automatically login in Windows 7 without password prompt next time.


          I hope that this helps you all with the AUTO-LOGIN and AUTO-STARTING of HomeSeer from boot.

          Curtis

          Comment


            #6
            Originally posted by bearhntr View Post
            UPDATED -- 6) ACTIONS TAB


            I was able to get this working on my Windows 7 Laptop (this should also work in Windows 10).

            Some takeaways from this setup:
            a) Create a local account on the Computer and make sure they are a member of the Administrator (LOCAL ADMIN) Group on the computer.
            b) Remember to follow each step in order, and exactly.
            c) There may be a way to set this up to run as a SERVICE in Windows (still investigating).

            Here is what I did:

            1) Go to the USER ACCESS CONTROL settings and make the following changes:

            Click image for larger version Name:	UAC_Settings.png Views:	0 Size:	204.2 KB ID:	1445344


            2) Next go to the TASK SCHEDULER and [ Run As Administrator ] (Always - even if making a change) - This even if you are already using an account with "Local Admin" rights.

            3) Use the CREATE TASK option (this allows for a walk-through / wizard type building of the task):

            Click image for larger version Name:	TashSched_1.png Views:	0 Size:	371.7 KB ID:	1445345


            4) GENERAL TAB -- Use the following settings (you can call it what you want - and whatever description you want):

            Click image for larger version Name:	TashSched_2.png Views:	0 Size:	11.1 KB ID:	1445346
            *** Make sure that you use the CHANGE USER OR GROUP to choose the 'Local User' you created to run the task.


            5) TRIGGERS TAB -- Make sure you are using the following settings (specifically the USER you created for running HomeSeer).:

            Click image for larger version Name:	TashSched_3.png Views:	0 Size:	10.7 KB ID:	1445347


            6) ACTIONS TAB -- See Settings below - point to the location where HS4.exe is installed: ** NOTE: I did some testing, some of the Plug-Ins would not run unless you add the START IN folder (WITHOUT QUOTES) - you will get a Scheduler.dll error.

            Click image for larger version Name:	TashSched_4.png Views:	0 Size:	18.9 KB ID:	1445400


            7) CONDITIONS TAB -- No Settings are set:

            Click image for larger version Name:	TashSched_5.png Views:	0 Size:	16.0 KB ID:	1445349


            8) SETTINGS TAB - I used the settings below:

            Click image for larger version Name:	TashSched_6.png Views:	0 Size:	10.9 KB ID:	1445350

            9) SAVE the Task - and verify that you can see it in the list of TASKS. If you are logged in as the user you setup in the task - you can MANUALLY run it after closing HS4 - it should start the application back up. If not - LOGOFF the PC and login with the user you created - see if the TASKS starts automatically.


            Below are the steps to set the PC to AUTO-MAGICALLY login with a user. This will basically, with the steps above set your PC to boot from a power failure or any other restart task, LOGIN and LAUNCH HOMESEER.

            1) Press “Win” + “R” key at the same time to open “Run” window. Type in: netplwiz, click “OK”.

            2) In “User Accounts” window, select the target user that needs to automatically sign in Windows 7.

            3) Uncheck the option “Users must enter a user name and password to use this computer”. Then click “OK”.

            Click image for larger version Name:	Auto_Login.png Views:	0 Size:	14.0 KB ID:	1445351

            4) When “Automatically sign in” window pops up, type password and click “OK”. This user account will automatically login in Windows 7 without password prompt next time.


            I hope that this helps you all with the AUTO-LOGIN and AUTO-STARTING of HomeSeer from boot.

            Curtis
            Thanks Curtis,

            Working well now (in windows 10)

            Antonio

            Comment


              #7
              Hey Curtis,

              I'm running a HomeTrollerPlus (Win10) which was set-up to run on start-up out-the-box, but with a couple of the fields set differently to your recommendations (times out after 3 days, has no delay before starting, and no start-in folder). So rather than create from scratch, I tried to edit the existing scheduled task that is there. However, it won't save at all - even if I make zero changes (i.e. open then hit OK).

              Do you know why I might be getting this error?

              Click image for larger version

Name:	Task_Error.jpg
Views:	109
Size:	58.1 KB
ID:	1511859


              Cheers,
              Dan.

              Comment


                #8
                Fixed my own problem - sharing here for others' benefit rather than deleting the earlier post.

                For some reason, the "user name" in the Triggers tab of pre-existing scheduled task was referring to a different computer (the "DESKTOP-I6N6CIE" in the screenshot above) and not the "HOMETROLLERPLUS" that my machine is called. So when I changed this to HOMETROLLERPLUS (in my case), and also set the "Use the following User Account" in the General Security options to be the full address of "HOMETROLLERPLUS\homeseer" everything saved and worked swimmingly.

                This has allowed me to fix my underlying problem of error: could not find library 'scheduler.dll', which is what led me here in the first place.


                So all-in, THANKS CURTIS!! :-)

                Comment

                Working...
                X