Skip to content

About

Safety-conscious PowerShell utilities: drive triage, emergency backup, SHA-256 duplicate audit.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

PowerShell Automation & Triage Suite

Safer, production-oriented versions of the five workflows recovered from Organizational Scripts Plan.md.

Safety model

  • Scripts use parameters instead of hard-coded drive letters.
  • Cleanup defaults to preview mode (-WhatIf).
  • The triage script is read-only except for its report folder; it does not remove Hidden/System attributes or copy the entire Recycle Bin.
  • Duplicate candidates are verified with SHA-256 hashes, not filenames alone.
  • Backup and installation results are checked; a green message does not automatically mean every item succeeded.
  • Logs/reports are timestamped.

Requirements

  • Windows 10/11
  • Windows PowerShell 5.1 or PowerShell 7+
  • Administrator rights only when Windows or a protected folder requires them
  • winget for the app installer

You do not need to permanently weaken PowerShell security. From PowerShell, run a script for the current process like this:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Then change into this folder and use the examples below.

Recommended order

1. Inspect a drive (read-only)

.\01-Inspect-Drive.ps1 -DriveLetter F

For a slower recursive file summary:

.\01-Inspect-Drive.ps1 -DriveLetter F -Detailed

2. Back up before reinstalling Windows

Use a destination that is not inside either source.

.\02-Emergency-Backup.ps1 -BackupRoot 'F:\01_SYSTEM_BACKUPS' -IncludeSecondaryDrive D

The script creates a dated folder and Robocopy logs. Robocopy exit codes 0–7 can indicate success with differences; 8+ means at least one failure. Inspect the logs before erasing anything.

3. Remove empty folders safely

Preview first (default):

.\03-Remove-EmptyFolders.ps1 -TargetPath 'F:\04_TRIAGE_WORK_AREA'

Actually remove only the displayed empty folders:

.\03-Remove-EmptyFolders.ps1 -TargetPath 'F:\04_TRIAGE_WORK_AREA' -Apply

This never deletes files. It excludes Recycle Bin and System Volume Information paths.

4. Install creator applications

Preview package availability:

.\04-Install-CreatorApps.ps1

Install:

.\04-Install-CreatorApps.ps1 -Apply

To omit packages:

.\04-Install-CreatorApps.ps1 -Apply -ExcludeId 'BlackmagicDesign.DaVinciResolve','Blizzard.BattleNet'

5. Audit multiple drives and Recycle Bin metadata

.\05-Triage-And-DuplicateAudit.ps1 -ScanRoot 'C:\Users\YourName','D:\','E:\' -OutputRoot 'F:\04_TRIAGE_WORK_AREA\Reports'

Start with narrower folders if the drives are large. Hashing every file can take hours. The script writes:

  • FileCatalog.csv
  • DuplicateGroups.csv
  • RecycleBinMetadata.csv (when Windows exposes it)
  • Errors.csv
  • Summary.txt

The audit does not delete duplicates. Review duplicate groups manually. Matching SHA-256 hashes establish identical bytes, but you still decide which location belongs in your archive.

Suggested 8 TB structure

F:\
  01_SYSTEM_BACKUPS\
  02_CONTENT_CREATION\
    Raw_Footage\
    Edited_Videos\
    Stream_Assets\
    Audio_Models\
  03_PERSONAL_ARCHIVE\
    Photos\
    Documents\
    Family_Media\
  04_TRIAGE_WORK_AREA\
    Reports\
    Dupe_Review_Buckets\
  05_UTILITIES_AND_SCRIPTS\

Troubleshooting

  • Access denied: reopen PowerShell as Administrator, or scan only folders you own.
  • Drive not found: confirm the current letter in File Explorer or Get-Volume.
  • Robocopy exit 8+: read the dated .log; check free space, permissions, disconnections, and path length.
  • winget missing: install/update App Installer from Microsoft Store, then reopen PowerShell.
  • Package unavailable: package IDs change; run winget search <name> and update the ID in script 04.
  • Audit is slow: scan smaller roots; the script first groups by size and hashes only size-collision candidates.
  • Empty-folder preview differs later: applications may recreate folders or write files between preview and apply. Run preview again immediately before -Apply.

How the suite is designed

Each script follows the same architecture: validate inputs, perform a read-only discovery phase, execute only the requested action, capture errors/results as data, and finish with an auditable summary. PowerShell advanced-script features ([CmdletBinding()], typed param blocks, ValidatePattern, ShouldProcess, try/catch, and custom objects) make behavior predictable and reports easy to export.

About

Safety-conscious PowerShell utilities: drive triage, emergency backup, SHA-256 duplicate audit.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages