dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Remove-DbaOrphanUser doesn't properly check for users

Open Adam-Wenger opened this issue 8 years ago • 0 comments

Before submitting a bug report:

  • [X ] Ensure you are able to reproduce it on the latest released version (we release often)
  • [X ] Verified this bug is not already reported in an issue
  • [X ] Verified errors are not related to permissions
  • [X ] Can reproduce in a clean PowerShell session (clean = powershell -NoProfile)

Steps to Reproduce

Remove-DbaOrphanUser -SqlInstance $devInstance -Database Sandbox -Verbose # Always returns 0 orphans
'domain\AdamWenger' | Remove-DbaOrphanUser -SqlInstance $devInstance -Database Sandbox -Verbose # Always removes all available orphans, not just the ones piped in

Expected Behavior

Orphans are removed as specified (all or based on piping)

Actual Behavior

No Piping results in an inability to find orphaned users, and any users in the pipe results in all users being removed.

Environmental data

Powershell 5.1

Adam-Wenger avatar Dec 05 '18 00:12 Adam-Wenger