Skip to content

Fixing login SIDs with Switch-DbaLoginSID (new function) #3679

@Tonyw72

Description

@Tonyw72

Whether you inherited it, or did it yourself before finding Copy-DbaLogin in dbatools, you might have an environment with the same sql login with different SIDs across your server environment.

I wrote a blog post on how to find them, and have written the code to swap them out, by modifying the Copy-DbaLogin function with a few minor tweaks in this branch. https://github.com/Tonyw72/dbatools/tree/Switch-DbaLoginSID

New function: Switch-DbaLoginSID.ps1

This branch also includes a couple of other modifications:

  • Copy-DbaLogin.ps1 - Added a NoDatabase switch to the parameter list
  • Repair-DbaOrphanUser.ps1 - Changed how the database & users collection are created for performance
  • Update-SqlPermissions.ps1 - Added support for NoDatabase parameter in Copy-DbaLogins

I'm still cleaning up the examples and parameters in Switch-DbaLoginSID...

Any comments or suggestions ?

Thanks
Tony W

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurenew commandFeature request that would need a new command

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions