‎01-03-2012 11:40 PM - last edited on ‎04-01-2024 04:38 PM by Mercedes_O
Hello - I have a custom computer action that schedules a reboot for 2am the following morning. It looks lke this:
cmd.exe /C psexec \\{computer} at 2:00am psshutdown -r -f -c -t 10 /accepteula
This works fine (see below), but I would like to be able to have LS ask me what time to schedule the reboot. I'm sure this would require a script. I can write a script that asks for data (InputBox?), but I don't know how to write a script that would then insert this information as a parameter for the AT command. Do any of you master script writers know how to do this?
Thanks,
Jono
Solutions:
See post #7 where, with the assistance of other posters, I was able to come up with a valid way to do this.
See also post #14 where danielm greatly improved upon this, expanding it to include other options for CHKDSK and handling scheduled tasks.
‎01-13-2012 08:12 PM
‎01-19-2012 06:30 PM
dteague wrote:
Just wondering why you are using PSEXEC and not just AT since you can pass the computer name on it and it does the same thing.
"\\computer shutdown..."This would require my computer to be on the network and turned on at the scheduled time. In most cases, the target computer is a server that I'd want to reboot in the middle of the night. My computer would be with me at home and shutdown at that time.
"AT {time} shutdown..."This is the desired result.
‎01-19-2012 09:59 PM
‎01-19-2012 11:34 PM
dteague wrote:
I see what it is, you were putting the time in the wrong place. It has to be after the server name for it to schedule it on that machine. I am supprised that it scheduled it on your machine, and not just errored and given you the AT help dump.
‎01-12-2012 04:57 PM
‎01-11-2012 07:50 PM
{actionpath}SchedReboot.bat {computer}
@echo off
ECHO.
set /p sdtime=What time?
ECHO.
ECHO Time entered: %sdtime%
psexec \\%1 at %sdtime% shutdown -r -f
ECHO.
ECHO Press any key to close this window...
pause>nul
‎01-11-2012 06:10 PM
‎01-05-2012 04:50 PM
cmd.exe /K psexec \\{computer} at 2:00am shutdown -r -f
‎01-04-2012 05:45 PM
-t Specifies countdown in seconds until shutdown (default is 20) or
the time of shutdown (in 24 hour notation)
‎01-04-2012 05:59 PM
ejensen wrote:
Actually Jono, after thinking about it a few minutes... just use the psshutdown utility form sysinternals (same guys that make psexec).
there is a command line switch to specify the time of the shutdown or reboot:-t Specifies countdown in seconds until shutdown (default is 20) or
the time of shutdown (in 24 hour notation)
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now