RDS Logins Cause Scheduled Task to Fail

MsYemi 6 Reputation points
2022-11-28T16:31:19.89+00:00

Bear with me as this is quite a nuanced issue!

  • I have a scheduled task (run through Windows Task Scheduler) that runs daily before office hours that runs reports that need to be updated. The process does lots of things before the final part, which opens an Excel session to run a macro that produces the reports formatted as required.
  • The issue I have is that the last step (the Excel bit) mostly does not run, so every day I have to open up Excel and run the macro manually.
  • I know the macro works and that at times the full script including the Excel part will run.
  • After months of trying to figure out what are the circumstances in which the whole process will run correctly, I have concluded that if I am able to log on to the machine on which the task runs directly at any point before the next task run is scheduled, then this resets whatever is blocking Excel and the last bit of the script runs with no issue. However, if my last login to the machine is via Remote Desktop Services prior to the task running, then the Excel bit of the script won't run and it stays that way until I am next able to log on to the machine directly (or we have a major Windows update that seems to reset everything).
  • The problem is the occasions on which I can log on to the machine directly and not via RDS are few and far between as I am currently working from home full time (also, the current machine this set up is on is actually on another continent to my office place so even if I could go into the office, the machine still wouldn't be there). - Has anyone encountered this problem and is it resolvable?

Set up is as follows:

  • The machines are business computers; I have admin rights, but the scope of them is still limited by group policy as I am not in IT.
  • They are running Windows 10 Enterprise
  • McAffee Endpoint Security is running (I'm convinced this is involved in the issue, but I'm not sure how)
  • The scheduled task does the following:
    1. Logs on to network with my profile with highest privileges available
    2. Runs a batch file that launches a PowerShell script
    3. PowerShell script does lots of things including opening other programs to run scripts in them and pulling data itself directly, ending with the aforementioned Excel bit

I've looked at the event log error (attached) and everything the internet suggests has not resolved it and nowhere can I find this connection to RDS logins.

My IT department have been unable to fix the issue so far (though I've only just confirmed to them the pattern relates to RDS logins). Any suggestions would be greatly appreciated.

264858-task-error.png

Remote Desktop
Remote Desktop
A Microsoft app that connects remotely to computers and to virtual apps and desktops.
4,390 questions
Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,312 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,709 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Dennis Appelgren 0 Reputation points
    2023-03-09T10:44:12.24+00:00

    I have the exact same issue.

    It was working like a charm with Office 2016 installation, but after upgrading to Office Pro Plus v2202, I get exact same issue.

    Same behaviour when loggin in with RPD, and same eventlog entry.

    If you are using a newer version of Excel, try using 2016 to test it.

    /Dennis

    0 comments No comments