$local:_scope = 0;
while ($true) { try { Get-Variable -Scope $_scope | Out-Null; $_scope += 1 } catch { return ($_scope - 1) } }