Additional Script Updates
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# Detection Script: Detect_LowDiskSpace.ps1
|
||||
|
||||
# Define the threshold for low disk space in GB
|
||||
$thresholdGB = 10
|
||||
|
||||
# Get the free space on the system drive
|
||||
$freeSpaceGB = [math]::Round((Get-PSDrive -Name C).Free / 1GB, 2)
|
||||
|
||||
if ($freeSpaceGB -lt $thresholdGB) {
|
||||
Write-Output "Low disk space detected: $freeSpaceGB GB free"
|
||||
exit 1
|
||||
} else {
|
||||
Write-Output "Sufficient disk space: $freeSpaceGB GB free"
|
||||
exit 0
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
# Remediation Script: Remediate_LowDiskSpace.ps1
|
||||
|
||||
# Clear temporary files
|
||||
$TempFolder = "$env:Temp"
|
||||
Remove-Item "$TempFolder\*" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
|
||||
# Clear Windows Update cache
|
||||
$WindowsUpdateCache = "C:\Windows\SoftwareDistribution\Download"
|
||||
Remove-Item "$WindowsUpdateCache\*" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
|
||||
# Clear Recycle Bin
|
||||
Clear-RecycleBin -Force -ErrorAction SilentlyContinue
|
||||
|
||||
Write-Output "Disk space cleanup completed."
|
||||
Reference in New Issue
Block a user