Doctor, Don't Defenestrate: What to Do with Legacy Scripts
summary
Argues for triaging legacy scripts by scoring risk value and maintainability then doing specific work: add inline documentation and a README, write characterization tests with Pester to capture current AD-cleanup behavior, perform minimal refactors for clarity and reuse, and enable WhatIf support and a delete-users switch. Uses a real AD cleanup script, mocks AD calls in tests, runs the suite until tests stay green, and shows the script becomes safer, more maintainable, and ready for iterative replacement.
AI-written summary · about
chapters (16)
- 0:00Start
- 2:09Triage
- 8:53The Strangler Vine Pattern as Described by Martin Fowler
- 10:51Legacy Code
- 11:09When Do You Doctor It
- 14:09Inline Commenting
- 17:15Reference Documentation
- 18:14Notes
- 18:57Description
- 19:37Inputs and Outputs
- 21:37Readme
- 22:41Characterizing Current Behavior
- 24:31Default Behavior
- 27:05Refactoring
- 37:37Making Work Visible
- 41:11Resources
related talks
49mLessons from DevSecOps Trenches
47mTales from the Dev Side: What Went Wrong, What We Fixe & What You Can Steal
24mHow to delete everything: The clean-slate approach to technical strategy
47mWhy keeping your system secure is a bit like decluttering
31mTesting in Production
47mSafeguarding The Security Posture Of Your AD, Pre-Attack And Post-Attack
23mDevOps and Legacy Code
46mFrom Script to Tool: Building Robust, Meaningful Tools with PowerShell
