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.
cmd.exe /C /Q server.bat. Or you may make a shortcut and set it to run as minimized. – Biswapriyo Jun 13 '17 at 08:24SYSTEMaccount cannot find the "X" drive nor would it likely have permission to it if it's a share on a server i.e.\\server\share... see here for much more detail about this: https://superuser.com/questions/1214736/windows-10-scheduled-tasks-with-workstation-lock-unlock-not-being-triggered/1217125#1217125 – Vomit IT - Chunky Mess Style Jun 16 '17 at 01:31