Skip to content

Commit 548bdc5

Browse files
Sync-DbaLoginPermission / Update-SqlPermission: Fix bug when enabling or disabling login (#10061)
1 parent 1c4ce5c commit 548bdc5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

private/functions/Update-SqlPermission.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ function Update-SqlPermission {
4646
if ($SourceLogin.IsDisabled -ne $DestLogin.IsDisabled) {
4747
if ($Pscmdlet.ShouldProcess($destination, "Setting login $newLoginName IsDisabled to $($SourceLogin.IsDisabled).")) {
4848
try {
49-
$DestLogin.IsDisabled = $SourceLogin.IsDisabled
49+
if ($SourceLogin.IsDisabled) {
50+
$DestLogin.Disable()
51+
} else {
52+
$DestLogin.Enable()
53+
}
5054
$DestLogin.Alter()
5155
Write-Message -Level Verbose -Message "Setting login $newLoginName IsDisabled to $($SourceLogin.IsDisabled) on $destination successfully performed."
5256
} catch {

0 commit comments

Comments
 (0)