IM_SO_TIRED_BOSS.ps1 finally working clean
This commit is contained in:
@@ -1,13 +1,29 @@
|
|||||||
|
# usage:
|
||||||
|
## All paramaters are optional
|
||||||
|
## All paramaters are compatible with each other
|
||||||
|
## Default behavior is to restart immediately after zero time
|
||||||
|
## IM_SO_TIRED_BOSS -Seconds <int seconds> -Minutes <int minutes> -Hours <int hours> -ChkDsk $True
|
||||||
|
## Examples:
|
||||||
|
### IM_SO_TIRED_BOSS -Minutes 90
|
||||||
|
### IM_SO_TIRED_BOSS -Minutes 30 -Hours 1
|
||||||
|
### IM_SO_TIRED_BOSS -Minutes 30 -ChkDsk $True
|
||||||
|
|
||||||
Param(
|
Param(
|
||||||
[int]$Seconds = 0,
|
[int]$Seconds = 0,
|
||||||
[int]$Minutes = 0,
|
[int]$Minutes = 0,
|
||||||
[int]$Hours = 0
|
[int]$Hours = 0,
|
||||||
|
[bool]$ChkDsk = $false
|
||||||
)
|
)
|
||||||
|
|
||||||
# Force off for longer by doing offline modern chkdsk to tie up your computer to be unusable for a while
|
# Force off for longer by doing offline modern chkdsk to tie up your computer to be unusable for a while
|
||||||
# pipes y to it so its noninteractive
|
# pipes y to it so its noninteractive
|
||||||
# Requires admin terminal
|
# auto elevates to admin when run with -ChkDsk $True
|
||||||
# Write-Host 'y' | chkdsk C: /f /r
|
if ($ChkDsk) {
|
||||||
|
# elevate to admin
|
||||||
|
# set for offline chkdsk noninteractively by piping y to it lmao
|
||||||
|
# runs a cmd window as admin running "echo y | chkdsk C: /f /r" which then closes
|
||||||
|
Start-Process cmd.exe -Verb RunAs -ArgumentList "/c echo y | chkdsk C: /f /r"
|
||||||
|
}
|
||||||
|
|
||||||
# Current date object
|
# Current date object
|
||||||
$CurrentTime = Get-Date
|
$CurrentTime = Get-Date
|
||||||
@@ -37,5 +53,8 @@ Start-Job -ScriptBlock {
|
|||||||
# do the wait
|
# do the wait
|
||||||
Start-Sleep -Seconds $WaitSeconds
|
Start-Sleep -Seconds $WaitSeconds
|
||||||
|
|
||||||
|
# Add-Type -AssemblyName PresentationFramework
|
||||||
|
# [System.Windows.MessageBox]::Show("PING WORKING", "$RebootTime", 'OK', 'Error')
|
||||||
|
|
||||||
# Force reboot with no warning
|
# Force reboot with no warning
|
||||||
Restart-Computer -Force
|
Restart-Computer -Force
|
||||||
Reference in New Issue
Block a user