community-scripts icon indicating copy to clipboard operation
community-scripts copied to clipboard

New Community Script: Reboot

Open silversword411 opened this issue 1 year ago • 6 comments

silversword411 avatar May 17 '24 17:05 silversword411

Please merge if this looks good thx!

silversword411 avatar May 21 '24 05:05 silversword411

testwait

Doesnt work for me, changed afew things but not passing $Wait correctly

dinger1986 avatar May 21 '24 08:05 dinger1986

A 120 second wait on a 90 second killed script definitely won't work 😂

Probably need to update timeout to 12hrs or something crazy or agent is going to kill it while ps is waiting.

silversword411 avatar May 23 '24 01:05 silversword411

changed timeout to 300 seconds and wait to 120 seconds and still get the same

dinger1986 avatar May 23 '24 08:05 dinger1986

ChatGPT failed me... -wait on Restart-Computer also requires other flags. Let's just ps sleep x and then run it....with an expanded script timeout.

Actually tested this time.

silversword411 avatar May 23 '24 15:05 silversword411

Id just do it

param(
    [int]$Wait
)

if ($Wait) {
    shutdown -r -t $Wait
}
else {
    Restart-Computer -Force
}

dinger1986 avatar May 23 '24 16:05 dinger1986

Id just do it

Works for me! :)

silversword411 avatar May 29 '24 13:05 silversword411