Repository navigation
Release v1.4.2
Title: v1.4.2 - Collects the files the script creates, PowerShell run from memory, admin-aware runs
What's new
- Files the script creates are collected. Tools often write their own log, report or settings while they run. Debug-CMD now finds the
.log,.txt,.json,.csv,.xmland.inifiles created or changed during the run, in the script's folder and in folders the script mentions (C:\Name,%SystemDrive%\Name,$env:ProgramData 'Name'...). Their contents go into the.logand the.html, and lines that look like errors are marked. New options:COLLECT_FILES(default1) andCOLLECT_DIRS(extra folders, separated by semicolons). - Single-file tools are captured. Scripts that read their own PowerShell and run it from memory (
Invoke-Expression) are no longer a black box: the code is cut out exactly like PowerShell does, logged with line numbers, and saved as<name>_debug_<date>.embedded1.ps1. - Every
.ps1logged: files written or run by the script (even temporary ones it deletes), each PowerShell process it starts, decoded-EncodedCommandpayloads, and full command lines. - Administrator-aware (
ELEVATE=AUTO, new default): if the script containsrunas,fltmc,net sessionand similar, Debug-CMD relaunches itself as administrator (one UAC prompt) so it can follow scripts that restart themselves elevated. The elevated window stays open so errors remain visible. - Honest status: if a script restarted itself as administrator and could not be followed, the report says
INCOMPLETE - RESTARTED AS ADMINinstead ofOK. - HTML report now has the PowerShell section, "Run from memory" and "Files collected" cards, and the collected files with highlighted error lines.
Fixes
-
Folder detection ignores names like
C:\.that pointed at the whole drive. -
The report now always lists the folders it searched for created files, even when none were found.
-
set "PSEXE=...powershell.exe"andif exist ... set ...lines are no longer counted as PowerShell runs (debug and test mode). -
Test mode no longer analyzes embedded PowerShell as batch code: no more false "file not found" and "label does not exist" errors on single-file tools.
Notes
- Windows only. Tested on Windows 10.
- Only text files with the extensions above are collected, from at most 15 folders, 4 levels deep. Files over 1 MB show only their last 200 KB.