Question

I am trying to schedule a task with cmd prompt.The command that I am running is:

C:\Windows\system32\schtasks.exe /CREATE /SC ONLOGON /TN "mytask" /TR "C:\samp.txt" /RU "NT AUTHORITY\SYSTEM" /RP /F

The task is showing in task manager with username as SYSTEM ,and its status is Running with code 0x41301.But it(samp.txt) is not showing in desktop.

The same command if I am replacing the "NT AUTHORITY\SYSTEM" with currently logged on user then it(samp.txt) is showing on desktop.

How can I make the task to display on desktop with /RU "NT AUTHORITY\SYSTEM"

Was it helpful?

Solution

Did you try to add /IT ?
This is the only option which may allow you to display something on the active session using scheduled tasks. However, I am not sure that Windows will allow to interact with the desktop of another user.

Edit : You may use /RU BUILTIN\Users /IT, so any user will be able to run it interactively. What is you constraint on /RU system ?

If your goal is to display the samp.txt file content when a user logs on, another solution is to put the samp.txt in the startup folder of the "all users" start menu : C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

OTHER TIPS

could you try with psexec ? your command will be something like :

PSEXEC -i -s -d -w c:\ notepad.exe samp.txt
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top