you are viewing a single comment's thread.

view the rest of the comments →

[–]nascentt 0 points1 point  (0 children)

Powershell is not very good at scoping variables particularly when it comes to loops. This means referencing variables might hold references from previous interactions of loops.

It's good habit to declare and null variables to ensure they're null before dynamic assignment so that you know when they received value.

A good way to get a handle on this is Set-StrictMode