Windows Server 2008 R2 Task Scheduler: Task does not repeat - batch-file

i have created a task with the Task Scheduler on my Windows 2008 R2 Sever.
It opens a .bat file. This bat has no errors and works fine.
If I start the task (i.e. by clicking on run) it executes the bat file.
From now it should repeat every x minutes (currently set to 1 minute) but it does not.
I tried a lot and changed almost every property but it still does not repeat executing my bat file.
I have read different questions and answers but nothing worked.
Has anyone an idea what I am doing wrong?
Thanks!
Björn

It seems like the error was about the "begin"-property of the trigger. It was set to "When task is created/modified".
I changed it to a one time event.
Things work fine now.

Related

How to find what is creating a .txt file

I have a strange situation. I've caused strange situations before, but now it's happening to me. I have a .txt file ( log.txt) being created on a server drive and I don't know where it's coming from.
The contents of the .txt file say the actual date and the actual time an application process ran, but this the format of what's in the .txt file:
(date) (time) AM Starting Job: (date) (time) AM
I've checked a number of things to try to see what's causing this. I have identified a SQL Server Agent Job that runs at that specific time. It runs a SSIS package. Part of that package runs a PowerShell script that starts 16 processes of an application.
The txt file is defiantly showing data of when the PowerShell script is executing the 16 or so Start-Process's in that script.
The agent job doesn't have any steps to create such a file
The SSIS package doesn't have logging turned on. (Right-click the screen in Visual Studio > logging.)
There are no tasks on the project to create the .txt file in the SSIS project.
An application is running a process on part of this and I think that's what's creating it, but the developer doesn't think it's the app creating it.
Is there anything else I should check to see what's generating this?
I found the answer by using SysInternals > ProcMon. I scheduled the job at a time where I could start ProcMon and monitor the creation of the file. In this case, it was the tool I thought it was. The developer fixed the issue.
In case anyone else would like to learn more about SysInternals, here are a few links:
Info on SysInternals:
https://learn.microsoft.com/en-us/sysinternals/
ProcMon:
https://learn.microsoft.com/en-us/sysinternals/downloads/procmon
Video on how to find issues from the creator of SysInternals:
https://channel9.msdn.com/Events/Ignite/2016/BRK4028

Execute process task fails to execute Rust script in job

I have written a small Rust script for an import job. I added the script execution into the SSIS package through the Execute process task and set the correct working directory. Using the debugger, the script works without a problem, as it does when executed normally, e.g. through cmd or PowerShell.
When I start the job in SSMS as an Agent Job, the package fails with
The process exit code was "-1073741515" while the expected was "0".
What I tried
Replacing the script with a very basic Rust script that just writes one single line to a file in the working directory to exclude the possibility that the script somehow panics, but still nothing.
The script is compiled with the i686-pc-windows-msvc toolchain. With 64bit the script does not work at all on the server.
Permissions look okay for the executing and the working directory. Full control for both folders.
Since execution works on the server I think this should most likely be a permissions issue but I can't for the life of me not figure out what is wrong.
Okay the problem was indeed with the default SQL Server Service Agent-account that ran the job. If I run the job with a Proxy-account it runs fine.
I'll have to look into the configuration of the Service Agent but until then, Proxy account it is.

Exe running as a Service instead of a Application

Situation
I have a Win 2012 server in which i run an exe which is essentially a GUI. The server restarts every monday so on monday morning i have to log-on to the server using a generic account and manually start the exe.
Setup
I am planning to automate the activity of starting the exe every monday. For that i have written a batch file which starts the exe with some parameters. Also i have created a scheduled task that runs on Monday and triggers the batch file. The trigger that i have used in the scheduled task is "At Startup".
ISSUE
The issue that i am facing is that after the server is restarted i am not seeing my GUI(exe) running. When i checked on the Task Manager it is showing it running as Background Process however it is not coming to front and i am not seeing the GUI. I might be wrong but i think the exe is running as a process/service instead of running as an App.
Can someone please suggest a solution for this issue.
Thanks in advance.

Access macro did not run on the server when the database opened by a scheduled job

I have a scheduled job on the server. The job is to run a batch file at night when I am logged off. It simply opens an Access database and runs a macro. I have used /x to do this, and all references to files are UNC, not via mapped drives.
When I run the batch file by double clicking on it, it runs and finishes smoothly, however the scheduled job does not seems to be working. It opens the database and leaves it open until next morning and the macro is not executed. I have to clear MSACCESS.EXE from the Task Manager next morning.
I have tried with VBScript and found same result.
Does anyone have a clue?

task in task scheduler failing when executing batch file

I have a task set up on a windows server 2008 R2. This task is setup in the task scehduler to execute a batch file that backs up a mongo database, every 4 hours. I have it set up the same on 2 servers.
On 1 server it runs fine.
On the other, I get this error logged in the history and it doesn't execute.
Task Scheduler failed to start "\Backup MongoDb" task for user "*****". Additional Data: Error Value: 2147750687.
I am lost for ideas what the issue may be. Anyone got any ideas?
My workaround is to call a .BAT file from the Task Scheduler.
This batch file then calls the PowerShell script file:
powershell c:\dir1\AutoPopulate.ps1
Seems to work.
I have run into this a few times. Check the last run result on the task. If it says another instance is already running, right-click on the task and click "End." Then after it ends the task it should start again correctly the next time. You can also right click and choose "Run" to run it immediately.
Check the Security options of your Task.
Make sure, the option Run whether user is logged on or not is selected.

Resources