made new version of windos-repair in powershell with adnin perms, and upgraded force_me_off
This commit is contained in:
@@ -1,53 +1,46 @@
|
|||||||
|
# usage force_me_off -Hours <int> -Minutes <int> -GraceMinutes <int>
|
||||||
|
# default one hour, zero minutes, zero grace minutes
|
||||||
param (
|
param (
|
||||||
[Single]$Hours = 1,
|
[Single]$Hours = 1,
|
||||||
|
|
||||||
[Single]$Minutes = 0,
|
[Single]$Minutes = 0,
|
||||||
|
|
||||||
[Single]$grace_minutes = 2
|
[Single]$GraceMinutes = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
# some calcs
|
# some calcs
|
||||||
$wait_minutes = (($Hours*60)+$Minutes)
|
$wait_minutes = (($Hours*60)+$Minutes)
|
||||||
# $wait_seconds = ($wait_minutes*60)
|
$total_wait_minutes = ($wait_minutes+$GraceMinutes)
|
||||||
$total_wait_minutes = ($wait_minutes+$grace_minutes)
|
|
||||||
$total_wait_seconds = ($total_wait_minutes*60)
|
$total_wait_seconds = ($total_wait_minutes*60)
|
||||||
$grace_seconds = ($grace_minutes*60)
|
$reboot_time = $((Get-Date).AddHours($Hours).AddMinutes($Minutes + $GraceMinutes).ToString("hh:mm:ss tt"))
|
||||||
$reboot_time = $((Get-Date).AddHours($Hours).AddMinutes($Minutes + $grace_minutes).ToString("hh:mm:ss tt"))
|
|
||||||
# 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 reboot_time $reboot_time"
|
|
||||||
$popup_shell = New-Object -ComObject 'WScript.Shell'
|
|
||||||
|
|
||||||
Write-Host "`nFORCING YOUR STUPID ASS OFF IN $Hours hours $Minutes minutes plus $grace_minutes minutes grace period`n"
|
# environment
|
||||||
|
## Check for administrator privileges
|
||||||
# clean up any running
|
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||||
|
# Restart with elevated privileges
|
||||||
|
Start-Process powershell.exe -Verb RunAs -ArgumentList "-File `"$($MyInvocation.MyCommand.Path)`""
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
## clean up any sched backups
|
||||||
shutdown /a
|
shutdown /a
|
||||||
|
|
||||||
# current time
|
# time wasters
|
||||||
|
## checks C drive after reboot to waste time and fix errors
|
||||||
|
# chkdsk /r C:
|
||||||
|
## starts Windows Defender Offline Scan after reboot
|
||||||
|
# Start-MpWDOScan
|
||||||
|
|
||||||
|
# notify user
|
||||||
|
## Warning
|
||||||
|
Write-Host "`nFORCING YOUR STUPID ASS OFF IN $Hours hours $Minutes minutes plus $GraceMinutes minutes grace period`n"
|
||||||
|
## current time
|
||||||
Write-Host "`n$(Get-Date -Format 'hh:mm:ss tt') | Start Time"
|
Write-Host "`n$(Get-Date -Format 'hh:mm:ss tt') | Start Time"
|
||||||
|
## shutdown time
|
||||||
# shutdown time
|
|
||||||
Write-Host "$reboot_time | Reboot Time"
|
Write-Host "$reboot_time | Reboot Time"
|
||||||
|
## send da webhookd thingggg
|
||||||
Write-Host "`nSleeping for $Hours hours $Minutes minutes and forking to background to prevent cheating...`n"
|
|
||||||
|
|
||||||
webhook "SCHEDULED REBOOT AT $reboot_time" true
|
webhook "SCHEDULED REBOOT AT $reboot_time" true
|
||||||
|
|
||||||
# popup
|
# schedule (/t) forced (/f) reboot (/r)
|
||||||
$popup_shell.Popup("REBOOTING BY FORCE IN $Hours HOURS $Minutes MINUTES AT $reboot_time", 2, "REBOOTING AS FUCK IN $total_wait_minutes MINUTES", 0) | Out-Null
|
shutdown /r /f /t $total_wait_seconds
|
||||||
|
Write-Host "SCHEDULED REBOOT IN $total_wait_seconds seconds"
|
||||||
# schedule chkdsk to take up fuckin tons of time
|
pause # pause for clarity in the new window
|
||||||
Start-Process -FilePath cmd.exe -ArgumentList '/C "chkdsk /r C:"'
|
|
||||||
|
|
||||||
# set to reboot with windows defender offline scan scheduled to wastte even more time :wheeze:
|
|
||||||
Start-Process -FilePath powershell.exe -ArgumentList '-C "Start-MpWDOScan"'
|
|
||||||
|
|
||||||
# must use fuckin cmd bullshit grumble grumble
|
|
||||||
Start-Sleep -Seconds $total_wait_seconds
|
|
||||||
|
|
||||||
# popup
|
|
||||||
$popup_shell.Popup("REBOOTING BY FORCE IN $grace_minutes MINUTES", 2, "REBOOTING AS FUCK IN $grace_minutes MINUTES", 0) | Out-Null
|
|
||||||
|
|
||||||
# grace sleep
|
|
||||||
Start-Sleep -Seconds $grace_seconds
|
|
||||||
|
|
||||||
# reboot in 120 seconds
|
|
||||||
shutdown /r /t 120
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
# Check for administrator privileges
|
||||||
|
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||||
|
# Restart with elevated privileges
|
||||||
|
Start-Process powershell.exe -Verb RunAs -ArgumentList "-File `"$($MyInvocation.MyCommand.Path)`""
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "FIXING WINDOWS FULL STYLE"
|
||||||
|
|
||||||
|
Write-Host "ABORTING ANY SCHEDULED SHUTDOWN"
|
||||||
|
shutdown /a # cmd abort scheduled shutdowns
|
||||||
|
|
||||||
|
Write-Host "RUNNING WINDOWS MALICIOUS SOFTWARE REMOVAL TOOL (mrt)"
|
||||||
|
mrt # cmd malicious software removal tool
|
||||||
|
|
||||||
|
Write-Host "RUNNING SYSTEM FILE CHECKER (sfc)"
|
||||||
|
sfc /scannow # cmd system file checker, retreives and replaces bad system files
|
||||||
|
|
||||||
|
Write-Host "RUNNING DISM"
|
||||||
|
DISM /Online /Cleanup-Image /RestoreHealth # powershell checks image and replaces bad files
|
||||||
|
|
||||||
|
Write-Host "SCHEDULING OFFLINE CHECK DISK OF C: (chkdsk)"
|
||||||
|
chkdsk /r C: # cmd checks C drive after reboot to waste time and fix errors
|
||||||
|
|
||||||
|
Write-Host "SCHEDULING WINDOWS DEFENDER OFFLINE SCAN"
|
||||||
|
Start-MpWDOScan # powershell starts Windows Defender Offline Scan after reboot
|
||||||
|
|
||||||
|
Write-Host "REBOOTING IN 5 MINUTES"
|
||||||
|
shutdown /r /t 300
|
||||||
Reference in New Issue
Block a user