Updated Reporting & 24H2 Updates Remediation
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
$folder = "$env:SystemRoot\SoftwareDistribution"
|
||||
$sizeBytes = (Get-ChildItem -Path $folder -Recurse -Force | Measure-Object -Property Length -Sum).Sum
|
||||
$sizeGB = $sizeBytes / 1GB
|
||||
|
||||
if ($sizeGB -gt 10) {
|
||||
Write-Output 1
|
||||
exit 1
|
||||
} else {
|
||||
Write-Output 0
|
||||
exit 0
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
# Stop Windows Update Services the services
|
||||
stop-service -Name wuauserv -ErrorAction SilentlyContinue -Force
|
||||
stop-service -Name bits -ErrorAction SilentlyContinue -Force
|
||||
|
||||
# Delete the contents of the SoftwareDistribution folder
|
||||
$softwareDistributionPath = "$env:SystemRoot\SoftwareDistribution\Download"
|
||||
if (Test-Path -Path $softwareDistributionPath) {
|
||||
Get-ChildItem -Path $softwareDistributionPath -Recurse | Remove-Item -Force -ErrorAction SilentlyContinue -Recurse
|
||||
} else {
|
||||
Write-Host "SoftwareDistribution folder does not exist."
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Delete the contents of the Catroot2 folder
|
||||
$catroot2Path = "$env:SystemRoot\System32\catroot2"
|
||||
if (Test-Path -Path $catroot2Path) {
|
||||
Get-ChildItem -Path $catroot2Path -Recurse | Remove-Item -Force -ErrorAction SilentlyContinue -Recurse
|
||||
} else {
|
||||
Write-Host "Catroot2 folder does not exist."
|
||||
}
|
||||
|
||||
|
||||
# Start the services again
|
||||
Start-Service -Name wuauserv -ErrorAction SilentlyContinue
|
||||
Start-Service -Name bits -ErrorAction SilentlyContinue
|
||||
Reference in New Issue
Block a user