Updated script

This commit is contained in:
Joeri 2026-02-07 10:22:50 +01:00
parent 7921ce00c5
commit 6c466f49f7
2 changed files with 216 additions and 13 deletions

49
cleanup.ps1.bk Normal file
View file

@ -0,0 +1,49 @@
if (Test-Path -Path "C:\Quest" -PathType Container) {
Write-Host "Directory exists! Skipping..."
} else {
Write-Host "Creating C:\Quest..."
New-Item -Path C:\Quest -ItemType Directory
Write-Host "Done."
}
if (Test-Path "C:\Program Files\Quest Help\Quest Help.exe") {
Write-Host "Quest Help found! Skipping installation..."
} else {
Write-Host "Quest Help not found! Downloading installer..."
Invoke-WebRequest -Uri https://hulpvanopafstand.be/assets/downloads/quest_help.exe -OutFile "C:\Quest\quest_help.exe"
Start-Process "C:\Quest\quest_help.exe"
Write-Host "Done."
}
# --------------------------------------------------------------------------------
# Add defender exclusions
Add-MpPreference -ExclusionPath "C:\Quest\*"
Add-MpPreference -ExclusionPath "C:\Program Files\Mesh Agent\*"
Add-MpPreference -ExclusionPath "C:\Program Files\TacticalAgent\*"
Add-MpPreference -ExclusionPath "C:\ProgramData\TacticalRMM\*"
Add-MpPreference -ExclusionPath "C:\Windows\Temp\is-*.tmp\tacticalagent*"
Add-MpPreference -ExclusionProcess "C:\Program Files\TacticalAgent\tacticalrmm.exe"
Add-MpPreference -ExclusionProcess "C:\ProgramData\TacticalRMM\tacticalagent*"
Add-MpPreference -ExclusionProcess "C:\Windows\Temp\is-*.tmp\tacticalagent*"
# --------------------------------------------------------------------------------
# Enable daily restore points
Enable-ComputerRestore -Drive 'C:'
Register-ScheduledTask -TaskName "Daily System Restore" -Action (New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-ExecutionPolicy Bypass -Command `"Checkpoint-Computer -Description \"\"AUTOMATIC-$(Get-Date -Format 'yyyyMMddHHmmss')\"\" -RestorePointType \"\"MODIFY_SETTINGS\"\"`"") -Trigger (New-ScheduledTaskTrigger -Daily -At 9am) -Settings (New-ScheduledTaskSettingsSet -StartWhenAvailable -DontStopOnIdleEnd -RunOnlyIfNetworkAvailable) -Principal (New-ScheduledTaskPrincipal -UserId "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest)
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name "SystemRestorePointFrequency" -Value 0 -Type DWORD -Force
# --------------------------------------------------------------------------------
# Updating all apps
winget upgrade --all
# --------------------------------------------------------------------------------
# Updating Windows
Write-Output "Updating Windows"
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module PSWindowsUpdate -Force -AllowClobber
Import-Module PSWindowsUpdate
Get-WindowsUpdate -AcceptAll -Install