Skip to content

Commit

Permalink
Update Get-DbaUserPermission.ps1 (#5135)
Browse files Browse the repository at this point in the history
Changing the cleanup query to run on tempdb
  • Loading branch information
tkwj authored and wsmelton committed Mar 4, 2019
1 parent 98f3185 commit 2290c31
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion functions/Get-DbaUserPermission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ function Get-DbaUserPermission {
}

$dbs = $server.Databases
$tempdb = $server.Databases['tempdb']

if ($Database) {
$dbs = $dbs | Where-Object { $Database -contains $_.Name }
Expand Down Expand Up @@ -291,7 +292,7 @@ function Get-DbaUserPermission {
#Delete objects
Write-Message -Level Verbose -Message "Deleting objects"
try {
$db.ExecuteNonQuery($endSQL)
$tempdb.ExecuteNonQuery($endSQL)
} catch {
# here to avoid an empty catch
$null = 1
Expand Down

0 comments on commit 2290c31

Please sign in to comment.