PowerShell has some very valuable features, but it is a mistake to believe that all those skills that you’ve derived from more conventional programming languages will transfer over to PowerShell. There are some pitfalls for the unwary. Michael Sorens warns abut the most common PowerShell pitfalls and explains how to avoid them.
https://www.simple-talk.com/sysadmin/powershell/a-plethora-of-powershell-pitfalls/
Ashamed to admin that I only caught #4 on my initial read, and I missed #1 because I skimmed Write-Output as Write-Host.