I have set of windows virtual machines, where I'm running a task every minute using task scheduler (schtasks.exe)
There is one batch file which creates the task, looks something like this:
SCHTASKS.EXE /Delete /TN "my_server" /F
SCHTASKS.EXE /CREATE /SC MINUTE /MO 1 /TN "my_server" /TR X:\mydrive\server.bat /RU %computername%\<username>
SCHTASKS.EXE /RUN /TN "my_server"
So this task runs every minute and every time it opens a command prompt window.
I want this task to run every minute but not open command prompt every time - it should run in minimized mode.
After googling for a solution, I've found few answers on stackoverflow itself to try /RU "NT Authority\System" instead of current user. So I've tried this as well:
SCHTASKS.EXE /CREATE /SC MINUTE /MO 1 /TN "my_server" /TR X:\mydrive\server.bat /RU "NT AUTHORITY\SYSTEM"
But it didn't work for me, not sure why. It didn't report any errors, I could see on command prompt "Task has been successfully created, Attempted to run the task", it scheduled the task but didn't start the task.