Created
May 13, 2022 19:56
-
-
Save johnvilsack/789e76ea13f0ae2ec5c2195786f200e6 to your computer and use it in GitHub Desktop.
Powershell Tattoo Idea (by Request)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$TIM = Get-CimInstance Win32_LogicalDisk -Filter "DeviceID='C:'" | Select-Object -ExpandProperty Size | |
$patience = Get-CimInstance Win32_LogicalDisk -Filter "DeviceID='C:'" | Select-Object -ExpandProperty FreeSpace | |
$stress = ($TIM - $patience) | |
if (($stress / $TIM)*100) -gt 50) {Write-Host "Take a Break"} | |
# 1. $TIM is the size of C:. It never changes, so it is a constant and in all caps | |
# 2. $patience is the FreeSpace left. It changes and is all lowercase because it is variable | |
# 3. $stress is the Used Space. This is the Total Disk minus whatever is free. | |
# 4. $stress divided by TIM then multiplied by 100 tells you a percentage of how much total stress you are dealing with | |
# 5. If the percentage of stress is greater than 50, write "Take a Break" to the window. | |
# Try changing the -gt 50 to see the number appear or disappear depending on value compared to your disk size. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment