Skip to content

Conversation

@aredspyinthebase
Copy link

@aredspyinthebase aredspyinthebase commented Mar 21, 2025

Bug introduced with original iteration PR to handle multiple credentials: #44

Same effect as #82 version just uses a subexpression to ensure an array of objects is created.

When generating a matching table with Where-Object { $_.instance -eq "$TargetInstance"}, the script assumes it will always return an array of objects, which is not true if there's only one matching instance name, so the iteration and resulting login test will never run.

Further, the iteration over the table incorrectly accesses the username and password fields, so the resulting login check fails because it instead iterates through the string instead of the array.

The change adds a @() subexpression to ensure the $TblResultsTemp is an iteratable collection and moves the element access from $TblResultsTemp.username[$i] to TblResultsTemp[$i].username (same for password field).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant