Simple reboot script

Hi, I’d need a simple script to reboot the endopoint after x minutes inserted it as parameter. I tried different reboot scripts as localuser without success. I also tried the script to run powershell command (using restart-computer as command) but nothing happened. The only reboot script that works it’s the one that asks for user interaction. Thanks.

Hi @datalink,

Thanks for your script request. We have asked our script developers to analyse and provide feedback,

Kind Regards,
PremJK

Hi @datalink

Have you tried the simple script to run a command line with the “shutdown.exe -r -t 300 -f” command? That one works fine for us…

Regards,

– Javier Llorente
Devoteam - Endpoint Security

Thank you! I’ve just added the following 2 lines to that script to make it more flexible:

delay=itsm.getParameter(‘delay’)
cmd='shutdown /r /f /t '+ delay

It is odd. The script works fine on most Windows 10 Pro 202H Endpoints but fails on other similar endpoints. The problem is that frequently the scripts don’t show more info. How to know why the script fail? Thanks

Hi, how to delete a endpoint’s log entries that after months are still “Started” state ? Thanks

hello @datalink ,

You can delete procedure log entries by filtering out procedures with “Started” status, select all then click Delete button.

Best regards,
Ilgaz

Hi @datalink,

Please try to run this script in other endpoints where you are getting failed status and reply back the status
https://scripts.itarian.com/frontend/web/topic/restart-system-without-user-interaction-by-given-time

Kind Regards,
PremJK

Hi, yes the script works perfectly thanks.

Hi @datalink,

Thank you so much for taking the time to check and providing your feedback.

Kind Regards,
PremJK

And for other python neophytes like me, if you add the line “delay= itsm.getParameter(‘delay’)” at the beginning of the script, you can enter the delay as string parameter.

Hello everyone,

You can also use the parameter /c to pass a comment for the user, just mind that this comment will be shown only if the delay is 600 seconds (10 minutes) or less.

Refer to the official Microsoft reference document for the shutdown command for the full details:

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/shutdown

Have a nice day and take care!
– Javier Llorente

Good idea! Thanks. It would be nice to pass it as parameter as well if the string passed is not empty.