This tool provides a methodical, sector-level verification of disk sanitization by bypassing the operating system's file system layers to read raw hardware data. It generates empirical evidence of a successful wipe by performing dynamic spot checks across the entire span of a physical drive.
The script utilizes the .NET System.IO.File class to open a direct handle to a physical device, bypassing standard Windows API pathing restrictions that often hinder raw disk access. It dynamically retrieves the physical geometry of the target disk to calculate an array of offsets distributed across the entire capacity.
By aligning these offsets to 512-byte sector boundaries, the tool ensures high-fidelity reads and avoids common "out of bounds" or "incorrect parameter" errors. During execution, the script evaluates each sampled buffer for non-zero data; if any residual bytes are detected, the tool provides a raw hexadecimal dump for empirical analysis.
- Dynamic Disk Selection: Polls the system for all connected physical disks and allows the user to select the target at runtime.
- Hardware-First Sizing: Fetches exact byte counts from the hardware to ensure the audit covers the true span of the drive.
- Empirical Spot-Checking: Samples 50 distinct locations across the drive to confirm a comprehensive wipe.
- Raw Hexadecimal Output: Displays the actual contents of "dirty" sectors to identify residual partition tables or file fragments.
- Summary Reporting: Concludes with a professional audit report including timestamps, duration, and a pass/fail status based on the zero-check results.
- PowerShell Environment: Compatible with Windows PowerShell 5.1 and PowerShell 7+.
- Administrator Privileges: Raw hardware access requires an elevated execution context.
- Execution Policy: The system must be configured to allow script execution (e.g.,
Set-ExecutionPolicy RemoteSigned).
- Open PowerShell as an Administrator.
- Execute the script:
.\DiskWipeAudit.ps1. - Select the target disk number from the provided list.
- Review the hexadecimal output for any non-zero data and verify the final Summary Report.