Optimizing PowerShell Scripts to Reduce High Memory Usage - Fix Microsoft Teams Slow Connection & Bandwidth Issues-Resolve Windows Security Cache Errors

Final checklist
- Confirm that the same symptom is gone after a restart or refresh.
- Keep the smallest working change and undo temporary diagnostic settings.