Skip to content

Instantly share code, notes, and snippets.

@alevyinroc
Created September 8, 2020 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alevyinroc/6c72c72172127c4474ee52cbe9d4c54f to your computer and use it in GitHub Desktop.
Save alevyinroc/6c72c72172127c4474ee52cbe9d4c54f to your computer and use it in GitHub Desktop.
$RestoreResult = Restore-DbaDatabase -SqlInstance $DstInstance -Database $DBName -Path $Sql17Backup.FullName -WithReplace;
Write-Output "Users in $DstInstance.$DBName before correcting";
Get-DbaDbUser -sqlinstance $DstInstance -Database $DBName | format-table -autosize -Property SqlInstance, Database, Name, Login;
Write-Output "Orphan users in $DstInstance.$DBName before correcting";
Get-DbaDbOrphanUser -sqlinstance $DstInstance -Database $DBName | format-table -autosize -property SqlInstance, DatabaseName, User;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment