https://rakhesh.com/powershell/using-closure-to-capture-the-variable-value-in-a-script-block/
Using closure to capture the variable value in a script-block