[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 465
  • Last Modified:

VB Script scheduled task for shutdown not prompting

I have a vb script that was pushed out as a scheduled task to prompt users for a shutdown of their machine.  If they click yes to the message box displayed it shutsdown the computer, if they click no it snoozes for 2 hours.  The script works great if an admin is logged on, however when users are logged on it does not prompt when run as a scheduled task.  You can manually launch the script and it will prompt but it won't when it runs as a scheduled task.

In testing I've given the users access to scheduled tasks in the control panel and also access to the vbs script.

Originally I thought it was because they could not see the scheduled task it would not prompt so i granted rights to C:\windows with a test account and it still didn't show the message.  I can provide any details needed, thanks for the help.
  • 2
1 Solution
if you go to the local machine and open control panel to scheduled tasks, open the task properties and under the task tab you have the option to run as and set the password.  i believe you are giving access to the task using the mentioned above but perhaps you need to run the task with admin privalages.  see attached
fcpsAuthor Commented:
It is running as an administrator
Hi fcps,

The reason your script is not displaying to the user is because its running under the admin account and thus the desktop it is trying to interact with is the admins.

Try running the account under the local machine user account as it has the ability to interact with the desktop. Otherwise I would suggest that you user a tool like PSShutdown from the PSTools Suite (Microsoft Website) with the -c switch as indicated below.

PsShutdown v2.52 - Shutdown, logoff and power manage local and remote systems
Copyright (C) 1999-2006 Mark Russinovich
Sysinternals - www.sysinternals.com

psshutdown -s|-r|-h|-d|-k|-a|-l|-o [-f] [-c] [-t [nn|h:m]] [-v nn] [-e [u|p]:xx
yy] [-m "message"] [-u Username [-p password]] [-n s] [\\computer[,computer[,..
   -a          Abort a shutdown (only possible while countdown is in progress)
   -c          Allow the shutdown to be aborted by the interactive user
   -d          Suspend the computer
   -e          Shutdown reason code (available on Windows XP and higher).
               Specify 'u' for unplanned and 'p' for planned
               shutdown reason codes.
               xx is the major reason code (must be less than 256)
               yy is the minor reason code (must be less than 65536)
   -f          Forces running applications to close
   -h          Hibernate the computer
   -k          Poweroff the computer (reboot if poweroff is not supported)
   -l          Lock the computer
   -m          Message to display to logged on users
   -n          Specifies timeout in seconds connecting to remote computers
   -o          Logoff the console user
   -p          Specifies optional password for user name. If you omit this
               you will be prompted to enter a hidden password.
   -r          Reboot after shutdown
   -s          Shutdown without poweroff
   -t          Specifies countdown in seconds until shutdown (default is 20) or
               the time of shutdown (in 24 hour notation)
   -u          Specifies optional user name for login to remote
   -v          Display message for the specified number of seconds before
               the shutdown. If you omit this parameter the shutdown
               notification dialog displays and specifying a value of 0
               omits the dialog.
   computer    Shutdown the computer or computers specified
   @file       Shutdown the computers listed in the file specified
fcpsAuthor Commented:
Thanks, we are looking into using this now

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now