VB Script scheduled task for shutdown not prompting

Posted on 2011-10-20
Last Modified: 2012-05-12
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.
Question by:fcps
    LVL 7

    Expert Comment

    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

    Author Comment

    It is running as an administrator
    LVL 4

    Accepted Solution

    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 -

    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

    Author Closing Comment

    Thanks, we are looking into using this now

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
    If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
    This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
    The viewer will learn how to download, install and use CrashPlan from on Windows 7. Open your browser and go to Click get started, it’s free then Click the Download CrashPlan button: Click save in Internet Explorer, the…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now