Skip to content

Commit

Permalink
New-DbaDbUser - Align code with docs (dataplat#8957)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasjordan authored Jun 7, 2023
1 parent 62e6234 commit a398d2f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions public/New-DbaDbUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,14 @@ function New-DbaDbUser {
$connParam.SqlInstance = $instance
$getDbParam = $connParam.Clone()
$getDbParam.OnlyAccessible = $True
if ($Database) { $getDbParam.Database = $Database }
if ($ExcludeDatabase) { $getDbParam.ExcludeDatabase = $ExcludeDatabase }
if (-not ($IncludeSystem)) { $getDbParam.ExcludeSystem = $True }
if ($Database) {
$getDbParam.Database = $Database
} elseif (-not $IncludeSystem) {
$getDbParam.ExcludeSystem = $True
}
if ($ExcludeDatabase) {
$getDbParam.ExcludeDatabase = $ExcludeDatabase
}

# Is the login exist?
if ($Login -and (-not(Get-DbaLogin @connParam -Login $Login))) {
Expand Down

0 comments on commit a398d2f

Please sign in to comment.