Jump to content

Recommended Posts

Posted

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?

Posted

I use a VB Script todo my shutdown in scheduled task:

 

strComputer = "." ' Local Computer

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _

strComputer & "\root\cimv2")

 

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

 

For Each objOs in colOs

objOs.Win32Shutdown(1)

Next

 

Works everytime!

  • 3 weeks later...
Posted

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?

  • 2 weeks later...
Posted
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.
Posted
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.

Posted

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"?

Posted
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?
Posted
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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...