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 ...
-
16th December 2011, 10:27 AM #1 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?
-
-
IDG Tech News
-
16th December 2011, 10:47 AM #2 I've seen this recently. Have you ensured that UAC is disabled on the server?
Matt
-
-
16th December 2011, 10:50 AM #3 have you selected for the task to run on request(server2008)
Have you selected run with highest Privledges
-
-
16th December 2011, 02:16 PM #4 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!
-
-
6th January 2012, 09:25 AM #5 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?
-
-
16th January 2012, 11:32 AM #6 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.
-
-
16th January 2012, 11:36 AM #7 
Originally Posted by
enjay
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.
-
-
16th January 2012, 12:36 PM #8 Enjay;
When you try to run the task manually and it fails, what is the code in the "Last run result" column.
Matt
-
-
17th January 2012, 12:47 PM #9 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"?
-
-
17th January 2012, 01:38 PM #10 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
-
Thanks to saundersmatt from:
enjay (17th January 2012)
-
17th January 2012, 01:46 PM #11 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?
-
-
17th January 2012, 01:48 PM #12 I know it seems nonsensical, but it has fixed things for me in the past.
Humour me?
Matt
-
-
17th January 2012, 04:29 PM #13 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: 
Similar Threads
-
By moggy in forum Windows Server 2000/2003
Replies: 7
Last Post: 17th December 2008, 04:05 PM
-
Replies: 4
Last Post: 19th September 2008, 11:06 AM
-
By jamin100 in forum General Chat
Replies: 3
Last Post: 19th February 2008, 03:08 PM
-
By AnnDroyd in forum MIS Systems
Replies: 3
Last Post: 15th January 2008, 01:36 PM
-
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
-
Forum Rules