made force_me_off.ps1 fuckin work lol
This commit is contained in:
@@ -9,13 +9,12 @@ param (
|
|||||||
$grace_minutes = 2
|
$grace_minutes = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
$job = Start-Job -ScriptBlock { Get-Process } # default get-process selects self
|
|
||||||
|
|
||||||
# some calcs
|
# some calcs
|
||||||
$wait_minutes = (($Hours*60)+$Minutes)
|
$wait_minutes = (($Hours*60)+$Minutes)
|
||||||
$wait_seconds = ($wait_minutes*60)
|
$wait_seconds = ($wait_minutes*60)
|
||||||
$total_wait_minutes = ($wait_minutes+$grace_minutes)
|
$total_wait_minutes = ($wait_minutes+$grace_minutes)
|
||||||
$grace_seconds = ($grace_minutes*60)
|
$grace_seconds = ($grace_minutes*60)
|
||||||
|
$stop_time = "$((Get-Date).AddHours($Hours).AddMinutes($total_wait_minutes).ToString("hh:mm:ss tt"))"
|
||||||
|
|
||||||
Write-Host "`nFORCING YOUR STUPID ASS OFF IN $Hours hours $Minutes minutes plus $grace_minutes minutes grace period`n"
|
Write-Host "`nFORCING YOUR STUPID ASS OFF IN $Hours hours $Minutes minutes plus $grace_minutes minutes grace period`n"
|
||||||
|
|
||||||
@@ -23,16 +22,15 @@ Write-Host "`nFORCING YOUR STUPID ASS OFF IN $Hours hours $Minutes minutes plus
|
|||||||
Write-Host "$(Get-Date -Format 'hh:mm:ss tt') | Start Time"
|
Write-Host "$(Get-Date -Format 'hh:mm:ss tt') | Start Time"
|
||||||
|
|
||||||
# shutdown time
|
# shutdown time
|
||||||
Write-Host "$((Get-Date).AddHours($Hours).AddMinutes($total_wait_minutes).ToString("hh:mm:ss tt")) | Reboot Time"
|
Write-Host " | Reboot Time"
|
||||||
|
|
||||||
|
webhook "FORCING REBOOT AT $stop_time"
|
||||||
|
|
||||||
Write-Host "`nSleeping for $Hours hours $Minutes minutes...`n"
|
Write-Host "`nSleeping for $Hours hours $Minutes minutes...`n"
|
||||||
|
|
||||||
# sleep
|
# sleep
|
||||||
Start-Sleep -Seconds ($wait_seconds)
|
Start-Sleep -Seconds ($wait_seconds)
|
||||||
|
|
||||||
# delete the job
|
|
||||||
Remove-Job -Id $job.Id
|
|
||||||
|
|
||||||
# force reboot
|
# force reboot
|
||||||
Write-Host "FORCING REBOOT IN $grace_minutes MINUTES"
|
Write-Host "FORCING REBOOT IN $grace_minutes MINUTES"
|
||||||
Restart-Computer -Force -Timeout $grace_seconds
|
Restart-Computer -Force -Timeout $grace_seconds
|
||||||
Reference in New Issue
Block a user