0% found this document useful (0 votes)
9 views2 pages

Beast Mode Laptop Maintenance Guide

The document outlines a script for laptop maintenance that includes functions to set power plans based on battery status, clear temporary files, and monitor system usage for CPU, memory, and disk. It provides alerts for high usage levels in these areas. The script concludes with a message indicating the completion of maintenance tasks.

Uploaded by

tejatarun770
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Beast Mode Laptop Maintenance Guide

The document outlines a script for laptop maintenance that includes functions to set power plans based on battery status, clear temporary files, and monitor system usage for CPU, memory, and disk. It provides alerts for high usage levels in these areas. The script concludes with a message indicating the completion of maintenance tasks.

Uploaded by

tejatarun770
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

# ------------------------------

# Beast Mode Laptop Maintenance


# ------------------------------

# Function to check power and set plan


function Set-PowerPlan {
$powerStatus = (Get-WmiObject -Class Win32_Battery).BatteryStatus
if ($powerStatus -eq $null -or $powerStatus -eq 1) {
Write-Host "🟡 On Battery: Setting Balanced Plan..."
powercfg /setactive SCHEME_BALANCED
} else {
Write-Host "🟢 Plugged In: Setting Best Performance Plan..."
powercfg /setactive SCHEME_MIN
}
}

# Function to clear temp files


function Clear-TempFiles {
Write-Host "🧹 Cleaning Temp Files..."
$tempPath = $env:TEMP
Get-ChildItem -Path $tempPath -Recurse -Force -ErrorAction SilentlyContinue |
Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
}

# Function to monitor system usage


function Monitor-System {
$cpu = Get-Counter '\Processor(_Total)\% Processor Time'
$cpuUsage = [math]::Round($[Link],2)

$mem = Get-CimInstance Win32_OperatingSystem


$totalMem = [math]::Round($[Link] / 1MB,2)
$freeMem = [math]::Round($[Link] / 1MB,2)
$usedMem = [math]::Round($totalMem - $freeMem,2)
$memUsagePercent = [math]::Round(($usedMem / $totalMem) * 100,2)

$disk = Get-Counter '\PhysicalDisk(_Total)\% Disk Time'


$diskUsage = [math]::Round($[Link],2)

Write-Host "🔥 CPU Usage: $cpuUsage %"


Write-Host "🔥 Memory Usage: $usedMem GB / $totalMem GB ($memUsagePercent %)"
Write-Host "🔥 Disk Usage: $diskUsage %"

# Alerts
if ($cpuUsage -gt 80) {
Write-Warning "⚠️ High CPU Usage: $cpuUsage %"
}
if ($memUsagePercent -gt 80) {
Write-Warning "⚠️ High RAM Usage: $memUsagePercent %"
}
if ($diskUsage -gt 80) {
Write-Warning "⚠️ High Disk Usage: $diskUsage %"
}
}

# Execute functions
Set-PowerPlan
Clear-TempFiles
Monitor-System
Write-Host "✅ Beast Mode Maintenance Complete."

You might also like