Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Creating Scheduled task in Windows 7

  • 16-12-2010 5:52pm
    #1
    Registered Users, Registered Users 2 Posts: 4,114 ✭✭✭


    I am creating a scheduled task from a DOS command that shuts down my PC at 1.00 every day. It adds it to the task scheduler but I want it to run "whether user is logged in or not" but I don't know how to do it in DOS.

    As I say, it is added to task scheduler but the option "Run only when user is logged on" is always ticked. This is what I have so far:

    SCHTASKS /CREATE /SC DAILY /MO 1 /TN ShutdownTask /TR "C:\Windows\System32\shutdown.exe" /ST 13:00:00


    I just need the extra bit that goes into the command above that makes it run whether the user is logged in or not.


Comments

  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    You'll get the "Run whether user is logged in or not" by including the /S Computername /RU username /RP password, so the scheduler knows the credentials that it's to use when running the program.

    If you just type in /RP, without entering the password within the command line, as below, it'll simply prompt you for the password to use, so that your password is not stored in the command buffer.
    SCHTASKS /CREATE /S mylocalcomputername /RU theusersname /RP /SC DAILY /MO 1 /TN ShutdownTask /TR "C:\Windows\System32\shutdown.exe" /ST 13:00:00

    Try typing
    schtasks /create /?
    into a console to see the other examples.

    If you get the error "Error: Access is denied" then you need to use an elevated command prompt.


  • Registered Users, Registered Users 2 Posts: 4,114 ✭✭✭lukin


    Just adding /ru "System" to the end of it fixed it.

    SCHTASKS /CREATE /SC DAILY /MO 1 /TN ShutdownTask /TR "C:\Windows\System32\shutdown.exe" /ST 13:00:00 /ru "System"


Advertisement