diff --git a/community_scripts.json b/community_scripts.json index c856ce32..af94a372 100644 --- a/community_scripts.json +++ b/community_scripts.json @@ -1028,6 +1028,20 @@ ], "default_timeout": 30 }, + { + "guid": "5bc815a0-d349-416f-8c3d-ac499d4da2e8", + "filename": "Win_Reboot.ps1", + "submittedBy": "https://github.com/silversword411", + "name": "Reboot/Restart Computer", + "description": "Reboots/Restarts the computer with an optional wait time before restarting.", + "syntax": "[-wait ]", + "shell": "powershell", + "category": "TRMM (Win):Other", + "supported_platforms": [ + "windows" + ], + "default_timeout": 86400 + }, { "guid": "f396dae2-c768-45c5-bd6c-176e56ed3614", "filename": "Win_Power_RestartorShutdown.ps1", diff --git a/scripts/Win_Reboot.ps1 b/scripts/Win_Reboot.ps1 new file mode 100644 index 00000000..6ea23c76 --- /dev/null +++ b/scripts/Win_Reboot.ps1 @@ -0,0 +1,28 @@ +<# +.SYNOPSIS + Reboots/Restarts the computer with an optional wait time before restarting. Max wait 24hrs + +.DESCRIPTION + This script restarts the computer forcefully. + +.PARAMETER Wait + Specifies the number of seconds to wait before restarting the computer. + +.EXAMPLE + -Wait 60 + Waits for 60 seconds and then restarts the computer. + +.NOTES + v1.0 5/17/2024 Created by silversword411 and dinger1986 +#> + +param( + [int]$Wait +) + +if ($Wait) { + shutdown -r -t $Wait +} +else { + Restart-Computer -Force +}