→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎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.
‎05-21-2019 06:35 PM
‎03-03-2015 06:18 PM
‎02-17-2015 03:00 PM
‎02-17-2015 02:55 PM
‎02-16-2015 11:36 PM
‎03-02-2012 12:18 AM
‎02-21-2012 11:42 PM
‎02-10-2012 06:16 PM
{actionpath}SchedReboot.bat {computer}
@echo off
if %1.==. GOTO END
:CHKDSK1
ECHO.
set /p chkdsk1=Schedule C Chkdsk? [1= /F 2= /R 3=StopCheck enter=skip]
if {%chkdsk1%}=={1} psexec -d \\%1 -s cmd /c "echo y|chkdsk c: /f"
if {%chkdsk1%}=={2} psexec -d \\%1 -s cmd /c "echo y|chkdsk c: /f /r"
if {%chkdsk1%}=={3} psexec -d \\%1 -s chkntfs c: /x
:STARTOFDELETE
ECHO.
NET TIME \\%1
ECHO Current AT Schedule is
at \\%1
REM Clearing variables
set chkdsk1=
set delsched=
set idnum=
set delagain=
set sdtime=
ECHO.
set /p delsched=Do you wish to delete a schedule (n/y) [enter=skip]?
if {%delsched%}=={y} goto yesdel
if {%delsched%}=={n} goto nodel
if %delsched%.==. goto nodel
goto nodel
:yesdel
set /p idnum=Enter number only of ID to delete [# or SPACE for All]?
at \\%1 %idnum% /delete
set /p delagain=Do you wish to delete another (n/y) [enter=skip]?
if {%delagain%}=={y} goto STARTOFDELETE
if {%delagain%}=={n} goto noagaindel
:noagaindel
:nodel
ECHO.
set /p sdtime=Time on Target Computers Local Time (2:00am , 02:00) [enter=skip]?
if %sdtime%.==. GOTO BLANK
ECHO.
ECHO Time entered: %sdtime%
at \\%1 %sdtime% shutdown -r -t 60 -f
Echo Reboot setup at time select with 60 second delay.
ECHO.
ECHO Press any key to close this window...
pause>nul
GOTO END
:BLANK
:END
‎01-19-2012 09:53 PM
at \\%1 %sdtime% shutdown -r -t 00 -f
What time? 14:00
Time entered: 14:00
Added a new job with job ID = 3
Current box
Status ID Day Time Command Line
-------------------------------------------------------------------------------
1 Each M 3:00 AM "D:\Update Dell\UpdateDellWarrantyInfo.exe"
CHQAUDT078
Status ID Day Time Command Line
-------------------------------------------------------------------------------
3 Tomorrow 2:00 PM shutdown -r -t 00 -f
Press any key to close this window...
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now