Invoke-Win11SecurityAuditAndRepair

1.0.0

An automated PowerShell utility for Windows 11 that self-elevates to Administrator and runs a two-phase security/health audit followed by a system repair and cache-reset routine, outputting a dark-themed HTML report to the Desktop and opening it automatically upon completion.

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Script -Name Invoke-Win11SecurityAuditAndRepair

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

(c) 2026 waresoft. All rights reserved.

Package Details

Author(s)

  • waresoft

Tags

powershell windows-11 security-audit system-repair windows-update bitlocker controlled-folder-access unquoted-service-paths smart-health html-report self-elevating

Functions

Log-Action

Dependencies

This script has no dependencies.

Release Notes

Key Features
Phase 1: Security & System Health Audit
BitLocker Encryption Check: Inspects drive C: encryption status and percentage via Get-BitLockerVolume.
Controlled Folder Access Audit: Checks Windows Defender ransomware protection mode (Enabled, Audit Mode, or Disabled) via Get-MpPreference.
Drive SMART Health Check: Evaluates physical disk health (Healthy vs. non-healthy states) across attached storage via Get-PhysicalDisk.
Unquoted Service Path Scan: Queries Win32_Service via Get-CimInstance to flag third-party service paths containing spaces without enclosing quotes.
24-Hour Critical Event Harvest: Captures recent System and Application events (Levels 1–3, up to 15 entries) before repair steps clear system logs.
Phase 2: System Repair & Recovery
Windows Update Reset: Stops wuauserv, bits, cryptsvc, and appidsvc, purges prior .bak/.old cache backups, renames SoftwareDistribution and catroot2 to .bak, and restarts the services.
Temp, Recycle Bin & Network Reset: Clears user/system/local temp directories, empties the Recycle Bin, flushes DNS client cache, clears the ARP cache, and reloads NetBIOS name tables.
Delivery Optimization & Package Caches: Clears Delivery Optimization cache (cycling dosvc) and purges caches for UniGetUI, winget, choco, npm, and pip when present.
Crash Dumps, Prefetch & UI Caches: Purges minidumps, MEMORY.DMP, Windows Error Reporting files, CBS logs, Prefetch files, and resets Font, thumbnail, and icon caches (cycling FontCache).
Event Logs, Windows.old & Shadow Copies: Flushes populated event logs via wevtutil.exe, removes lingering Windows.old folders if present, and deletes the oldest volume shadow copy on C: via vssadmin.
Drive Optimization & Defender Update: Runs TRIM/defrag optimization across fixed drives (Optimize-Volume) and updates Windows Defender signatures while reporting real-time protection, signature age, and last quick scan age.

FileList

Version History

Version Downloads Last updated
1.0.0 (current version) 8 11/23/2026