+ Post New Thread
Results 1 to 13 of 13
Windows Server 2008 R2 Thread, Scheduled Task - user must be logged in to run in Technical; I have set up a scheduled task on the server which runs a batch file containing loads of psshutdown.exe -blah ...
  1. #1
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75

    Scheduled Task - user must be logged in to run

    I have set up a scheduled task on the server which runs a batch file containing loads of psshutdown.exe -blah commands. This runs fine when set to run "only if the user is logged in", but doesn't run when set to run regardless or whether they're logged in or not.

    Any ideas why that might?

  2. #2

    Join Date
    Jul 2005
    Location
    Rugby
    Posts
    432
    Thank Post
    17
    Thanked 66 Times in 61 Posts
    Rep Power
    35
    I've seen this recently. Have you ensured that UAC is disabled on the server?

    Matt

  3. #3
    Mcshammer_dj's Avatar
    Join Date
    Feb 2007
    Location
    Portsmouth
    Posts
    929
    Thank Post
    35
    Thanked 160 Times in 129 Posts
    Rep Power
    93
    have you selected for the task to run on request(server2008)
    Have you selected run with highest Privledges

  4. #4
    IanT's Avatar
    Join Date
    Aug 2008
    Location
    @ the back of my server racks farting.....
    Posts
    1,891
    Thank Post
    2
    Thanked 118 Times in 109 Posts
    Rep Power
    60
    I use a VB Script todo my shutdown in scheduled task:

    strComputer = "." ' Local Computer
    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonat e,(Shutdown)}\\" & _
    strComputer & "\root\cimv2")

    Set colOs = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

    For Each objOs in colOs
    objOs.Win32Shutdown(1)
    Next

    Works everytime!

  5. #5
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    The task is set to run on demand, but wasn't set to "highest privileges"; I've changed that and will see what happens later.

    UAC is set to "never notify"; I don't see how to actually disable it - where is that set (Server 2008 R2) and is it a good idea to disable it on a server?

  6. #6
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    Still doesn't work, even with "run with highest privileges" enabled. It will only run when set to "run only when user is logged in"; if I set it to run regardless, it won't run even when triggered manually whilst logged in.

  7. #7

    Join Date
    May 2011
    Location
    Jus North of London, close but not too close
    Posts
    739
    Thank Post
    172
    Thanked 56 Times in 54 Posts
    Rep Power
    35
    Quote Originally Posted by enjay View Post
    I have set up a scheduled task on the server which runs a batch file containing loads of psshutdown.exe -blah commands. This runs fine when set to run "only if the user is logged in", but doesn't run when set to run regardless or whether they're logged in or not.

    Any ideas why that might?
    Have a look at Shutdownertron by PowdarMonkey. It is distributable by Policy (MSI) and there is an adm file to enable things like enable a logged on user to cancel the task, set the shutdown time etc.

    Just installed at my site in one classroom and works with Windows 7.

  8. #8

    Join Date
    Jul 2005
    Location
    Rugby
    Posts
    432
    Thank Post
    17
    Thanked 66 Times in 61 Posts
    Rep Power
    35
    Enjay;

    When you try to run the task manually and it fails, what is the code in the "Last run result" column.

    Matt

  9. #9
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    It fails with a result of 0x1. I think this is something to do with the script itself, not the scheduled task, as I have other tasks set to run regardless of logged on user, and those run fine.

    The task runs a batch file which looks like:
    "\\server_name\IT Support Dept$\Applications\PsTools\psshutdown.exe" -k -c -f -t 60 -n 3 -m "This computer is about to turn off - please click cancel if you wish to carry on working." \\ICT1-01
    "\\server_name\IT Support Dept$\Applications\PsTools\psshutdown.exe" -k -c -f -t 60 -n 3 -m "This computer is about to turn off - please click cancel if you wish to carry on working." \\ICT1-02
    etc etc

    Anyone suggest anything which could cause that to only run when set to "only run when use is logged in"?

  10. #10

    Join Date
    Jul 2005
    Location
    Rugby
    Posts
    432
    Thank Post
    17
    Thanked 66 Times in 61 Posts
    Rep Power
    35
    Enjay, can you try explicity delegating full control permissions to the folder and batch file for the user you're trying to run the task as.

    Matt

  11. Thanks to saundersmatt from:

    enjay (17th January 2012)

  12. #11
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    The user is a domain admin, so I don't think it is that. Also, if it were a rights issue, it would stop it however the task were set to run, no?

  13. #12

    Join Date
    Jul 2005
    Location
    Rugby
    Posts
    432
    Thank Post
    17
    Thanked 66 Times in 61 Posts
    Rep Power
    35
    I know it seems nonsensical, but it has fixed things for me in the past.

    Humour me?

    Matt

  14. #13
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,485
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    75
    Sorted. Not a permissions thing in the way you were thinking, @saundersmatt, but permissions nonetheless - I moved the batch file and executable which the task was running to sit on the same server as it was scheduled on, and it is now running. Thanks for pointing me in the right direction.

SHARE:
+ Post New Thread

Similar Threads

  1. Firefox can't log in to https sites
    By jamin100 in forum General Chat
    Replies: 8
    Last Post: 20th May 2014, 11:58 AM
  2. Stop Users Logging In to Domain
    By moggy in forum Windows Server 2000/2003
    Replies: 7
    Last Post: 17th December 2008, 04:05 PM
  3. Replies: 4
    Last Post: 19th September 2008, 11:06 AM
  4. Logging in to a new SIMS installation
    By AnnDroyd in forum MIS Systems
    Replies: 3
    Last Post: 15th January 2008, 01:36 PM
  5. New users can't log in to Outlook Web Access
    By WithoutMotive in forum Windows
    Replies: 5
    Last Post: 7th September 2007, 11:17 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •