Don't do that, do this instead: PowerShell worst practices and..
summary
Live demos show exact fixes and tradeoffs not platitudes: replace aliases and positional args with full names, run script analyzer to auto-fix style, prefer PSCustomObject over Add-Member (add-member is slow), avoid += on arrays (10k items takes seconds; generic List is far faster), prefer Get-CimInstance to Get-WmiObject and query the registry not MSI (500 ms vs many seconds), use parameter binding, supportsShouldProcess and proper credential objects, GUI prototype works but is fragile and needs front-end/back-end separation.
AI-written summary · about
chapters (13)
- 0:00Start
- 2:55Source Control
- 5:11Aliases
- 7:16Positional Parameters
- 8:29Working with Objects
- 12:02Magic Function Variables
- 17:29Examples of of Backticks
- 18:44If Statements
- 22:10Collections
- 28:10For Loops
- 31:18Wmi
- 36:34Parameter Sets
- 47:05Gooeys
related talks
47mThe Human Side of PowerShell Scripting
01h 16mLevel Up Your PowerShell: Essential Tips, Tricks, and Techniques
01h 29mPerformance and Technique Tweaks: The Encore
47mTempting Fate: Patterns & practices for shareable scripts and functions
44m99 Problems, but Slow PowerShell Ain't One!
52mPowerShell Module Design Rules (and When to Bend Them)
37mUsing Windows PowerShell to create scripts your users want to use
40mCode Writing Code, say what now! Meta Programming and PowerShell
