Link to home
Start Free TrialLog in
Avatar of bosn1
bosn1

asked on

Scheduling a task with the AT command

Is it possible to use the a AT command to schedule a task that will run daily and be visible to any user that is logged in?  The task also has to run if there is no user logged in.  
Avatar of sirbounty
sirbounty
Flag of United States of America image

run it under the system account...if you're using xp, you can use schtasks.

Example, to run internet explorer every day at noon:

schtasks /create /ru system /sc daily /st 12:00:00 /tn IE /tr "iexplore.exe"
Of course, IE wouldn't be visible by other users in that context - what sort of task are you looking at exposing to all users?
Avatar of bosn1
bosn1

ASKER

I have to shutdown our desktops at night.  I have to provide the users with a 30 minute warning and an option to cancel.  I have everything built but cannot figure out how to schedule it to run under any user condition.
Have messenger enabled?

You could do something like

net send %computername% Computer shutting down in 30 minutes...

scheduled for 7:30, for example
and then have the shutdown command launch at 7:59 with a 60 second timer...I think shutdown is limited to 60 seconds max...

If you need it all in one batch file:
@echo off
net send %computername% Computer shutdown in 30 minutes.
ping 127.0.0.1 -n 1740
shutdown -s -t 60

Open in new window

If you're workstations are Windows XP perhaps tsshutdn will be your answer.

tsshutdn /?
Shut down a server in a controlled manner.

TSSHUTDN [wait_time] [/SERVER:servername] [/REBOOT] [/POWERDOWN]
         [/DELAY:logoffdelay] [/V]

  wait_time           Seconds to wait after user notification before
                      terminating all user sessions (default is 60).
  /SERVER:servername  The server to shut down (default is current).
  /REBOOT             Reboot the server after user sessions are terminated.
  /POWERDOWN          The server will prepare for powering off.
  /DELAY:logoffdelay  Seconds to wait after logging off all connected
                      sessions (default is 30).
  /V                  Display information about actions being performed.


at \\REMOTECOMPUTERNAME 1:00 /interactive tsshutdn 1800 /powerdown

2 boxes will appear. 1 DOS BOX which users can press Ctrl-C to cancel and a SYSTEM SHUTDOWN notification.

Avatar of bosn1

ASKER

I have a package built that provides the user with a 30 minute warning and the option to cancel the shutdown.  The warning has a countdown timer that shows  the user how time they have left and a cancel button.  If the user doesn't hit cancel the shuts down.  The package also logs the date/time, computer and user name.  If the user hit cancels the package adds "Shutdown canceled by (user name)" to the log file.  

I am stuggling with how to add the process as a scheduled task that will run under any user condition and be visible to any user that is logged in.
ASKER CERTIFIED SOLUTION
Avatar of AmazingTech
AmazingTech

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I use this with my packaged reboot timer. Works great.

Although I also added to my reboot timer if user is not logged in to reboot now instead of waiting the desired timeout.
My package resides on the server so if I needed to change it a can without having to revisit the workstations again.