diff --git a/Windows-Scripts/force_me_off.ps1 b/Windows-Scripts/force_me_off.ps1 index 6135998..4aebdbd 100644 --- a/Windows-Scripts/force_me_off.ps1 +++ b/Windows-Scripts/force_me_off.ps1 @@ -10,13 +10,11 @@ param ( $wait_minutes = (($Hours*60)+$Minutes) $wait_seconds = ($wait_minutes*60) $total_wait_minutes = ($wait_minutes+$grace_minutes) +$total_wait_seconds = ($total_wait_minutes*60) $grace_seconds = ($grace_minutes*60) Write-Host "wait_seconds $wait_seconds wait_minutes $wait_minutes hours $Hours minutes $Minutes grace_seconds $grace_seconds grace_minutes $grace_minutes total_wait_minutes $total_wait_minutes" -# schedule chkdsk to take up fuckin tons of time -Start-Process -Verb RunAs -FilePath cmd.exe -ArgumentList '/C "chkdsk /r C:"' - Write-Host "`nFORCING YOUR STUPID ASS OFF IN $Hours hours $Minutes minutes plus $grace_minutes minutes grace period`n" # current time @@ -27,16 +25,22 @@ Write-Host "$((Get-Date).AddHours($Hours).AddMinutes($total_wait_minutes).ToStri Write-Host "`nSleeping for $Hours hours $Minutes minutes and forking to background to prevent cheating...`n" -Start-Job -ScriptBlock { +function do_admin_shit { + # handle interactive shit right away + ## schedule chkdsk to take up fuckin tons of time + Start-Process -Verb RunAs -FilePath cmd.exe -ArgumentList '/C "chkdsk /r C:"' + + ## must use fuckin cmd bullshit grumble grumble + ## cancel with shutdown /a + shutdown /f /r /t $total_wait_seconds + # sleep - Start-Sleep -Seconds 3 # $wait_seconds + Start-Sleep -Seconds $total_wait_seconds - # force reboot ## popup $shell = New-Object -ComObject 'WScript.Shell' # $shell.Popup(string , int , string , int ) $shell.Popup("REBOOTING BY FORCE IN $grace_minutes MINUTES", 2, "REBOOTING AS FUCK IN $grace_minutes MINUTES", 0) ## reboot, force, delay $grace_seconds seconds - ## must use fuckin cmd bullshit grumble grumble - ## cancel with shutdown /a - Start-Process -FilePath shutdown.exe -ArgumentList "/f /r /t $grace_seconds" -} | Out-Null # no bizzle \ No newline at end of file +} + +do_admin_shit | Out-Null \ No newline at end of file