Windows 10 Scheduled Task only runs batch file if I am logged on

Page 3 of 3 FirstFirst 123

  1. Posts : 829
    Windows 7
       #21

    Is there a reason it has to run from an OneDrive folder as opposed to any other local folder? I don't think it's a rights issue, but the semantics of how Windows treats local OneDrive resources when the user isn't around. The Windows Cloud API runs a virtual filesystem, and not as an old fashioned sync folder which lives on the NTFS filesystem.
      My Computer


  2. Posts : 14
    Windows 10
    Thread Starter
       #22

    garlin said:
    Is there a reason it has to run from an OneDrive folder as opposed to any other local folder? I don't think it's a rights issue, but the semantics of how Windows treats local OneDrive resources when the user isn't around. The Windows Cloud API runs a virtual filesystem, and not as an old fashioned sync folder which lives on the NTFS filesystem.
    Because DandyLabsBlogEntryRetriever.properties contains MySQL username and password values required to connect to the database to retrieve data, and having that information "out there" is a bit insecure. I put the file in a "locked" folder, i.e., a folder that gets moved to the Control Panel to "lock it".
      My Computer


  3. Posts : 829
    Windows 7
       #23

    In my last workplace, our devs' normal procedure was to create non-interactive local or network service accounts and have the [SQL] database grant them access based on identity. This removes the problem of passing stored credentials.

    You create a local account, and under Security Policy Editor: Deny logon locally & Deny logon thru Remote Desktop.
    active directory - Setting a Windows Non-Interactive User Account - Server Fault
      My Computer


  4. Posts : 14
    Windows 10
    Thread Starter
       #24

    garlin said:
    In my last workplace, our devs' normal procedure was to create non-interactive local or network service accounts and have the [SQL] database grant them access based on identity. This removes the problem of passing stored credentials.

    You create a local account, and under Security Policy Editor: Deny logon locally & Deny logon thru Remote Desktop.
    active directory - Setting a Windows Non-Interactive User Account - Server Fault
    So I created a local user "batchuser" with your beforementioned restrictions in Local Security Policy, edited the Scheduled Task to run as "batchuser" logged in or not / do not store password, and set it up to run.

    It actually ran, but now I have this error message:

    Code:
    Error: Could not find or load main class com.dandylabs.DandyLabsBlogEntryRetriever
    Caused by: java.lang.ClassNotFoundException: com.dandylabs.DandyLabsBlogEntryRetriever
    Is there something I need to do with "batchuser", or am I missing the point altogether?
      My Computer


  5. Posts : 829
    Windows 7
       #25

    We're back to a missing environment issue, but that's a better problem than the previous situation.
      My Computer


  6. Posts : 14
    Windows 10
    Thread Starter
       #26

    garlin said:
    We're back to a missing environment issue, but that's a better problem than the previous situation.
    I made sure "batchuser" had access to all of the folders involved: /Tools, /batch, /classes, and /jar, and even to the hidden folder in the Control Panel. Set the scheduled task to 10pm EST. Left for a couple of hours after signing out. Came back around 12:45am and logged in. Scheduled task never ran at 10pm but is running at 12:46 after I logged in (same exact original problem). At 12:47am I received the following error:

    Code:
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
    	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
    	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
    	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
    	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
    	at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
    	at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:338)
    	at com.mysql.cj.protocol.a.NativeAuthenticationProvider.negotiateSSLConnection(NativeAuthenticationProvider.java:777)
    	at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:486)
    	at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:202)
    	at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1340)
    	at com.mysql.cj.NativeSession.connect(NativeSession.java:157)
    	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956)
    	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826)
    	... 9 more
    Caused by: javax.net.ssl.SSLException: An established connection was aborted by the software in your host machine
    	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:127)
    	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:325)
    	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:268)
    	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:263)
    	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:144)
    	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1475)
    	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1381)
    	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:441)
    	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:412)
    	at com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:336)
    	at com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:188)
    	at com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:99)
    	at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:329)
    	... 16 more
    	Suppressed: java.net.SocketException: An established connection was aborted by the software in your host machine
    		at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:420)
    		at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:440)
    		at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:826)
    		at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1052)
    		at java.base/sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:82)
    		at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:356)
    		... 27 more
    Caused by: java.net.SocketException: An established connection was aborted by the software in your host machine
    	at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:325)
    	at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
    	at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
    	at java.base/java.net.Socket$SocketInputStream.read(Socket.java:982)
    	at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:469)
    	at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:463)
    	at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
    	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:110)
    	... 24 more
      My Computer


  7. Posts : 829
    Windows 7
       #27

    How does your MySql instance run? As a continuous background service, or only when you're logged on? Do you allow your PC to enter sleep mode?

    This log suggests the existing database network connection is broken, because the PC or the Java process has resumed after the SSL/network session has expired from inactivity.
      My Computer


  8. Posts : 14
    Windows 10
    Thread Starter
       #28

    garlin said:
    How does your MySql instance run? As a continuous background service, or only when you're logged on? Do you allow your PC to enter sleep mode?

    This log suggests the existing database network connection is broken, because the PC or the Java process has resumed after the SSL/network session has expired from inactivity.
    AFAIK it runs as a continuous database service via Local System, so it should be continuously available unless something amiss

    Windows 10 Scheduled Task only runs batch file if I am logged on-screen.jpg

    But the issue remains: The scheduled task itself does not run unless I am logged in, no matter who the user is ("phill", SYSTEM, "batchuser", etc.), even though it's set up to run whether the user is logged in or not. The task was set to run at 10:00pm EST but never ran until I logged back in, as the default Administrator, at 12:43am EST

    - - - Updated - - -

    I wound up changing the user from "batchuser" to "SYSTEM" and performed the following:

    1. Manually ran the scheduled task - Successful
    2. Scheduled the task for 7:17am EST and stayed online and active on my laptop doing other things - Successful
    3. Scheduled task for 7:30am EST, closed the laptop (putting it in Screen Lock), opened it up 20 minutes later, task and action ran and completed, however, the Java class and/or batch script was not only not run, but there were no error messages as well


    The MySQL errors went away in all three cases when I switched the user back to SYSTEM, but it appears that the scheduled task runs only if I remain online, active and using my laptop, otherwise, the task will run and complete, but absolutely nothing happens, not even an error message, even if I am in screen lock.

    Again, I am out of ideas.
      My Computer


  9. Posts : 17,013
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #29

    If a Task scheduler task generates a user interface [whether the task makes use of the user interface or not] then it cannot run whether logged in or not.
    I never experimented with such a task to find out if it could run if I happened to be logged in despite how I set the task up. It simply never occurred to me to find out.

    I used to make Task scheduler run a whether logged in or not task by changing the task to run a vbs script that calls the batch script I really want to run. Since the vbs [i.e. the task] generates no user interface, Task scheduler is happy to co-operate - it neither knows nor cares what the task leads to after it completes.

    I no longer have any whether logged in or not tasks. It's at least four years since I last needed one.
    I have never used OneDrive.
    I have never tried to make Task scheduler run as the System user.
    I know nothing about MySQL.


    I hope this is useful and is not a mere distraction,
    Best of luck,
    Denis
      My Computer


  10. Posts : 14
    Windows 10
    Thread Starter
       #30

    If a Task scheduler task generates a user interface [whether the task makes use of the user interface or not] then it cannot run whether logged in or not.
    The task runs a Batch script which runs a Java program that generates visual output via System.out so if that counts as UI, then I apparently am generating UI, otherwise, I am not
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:40.
Find Us




Windows 10 Forums