File tree Expand file tree Collapse file tree 3 files changed +3
-5
lines changed Expand file tree Collapse file tree 3 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -532,7 +532,7 @@ function New-DbaLogin {
532
532
}
533
533
534
534
# Process the MustChangePassword property
535
- if ($currentPasswordMustChange -ne $newLogin.MustChangePassword ) {
535
+ if ($null -ne $currentPasswordMustChange -and $ currentPasswordMustChange -ne $newLogin.MustChangePassword ) {
536
536
try {
537
537
$newLogin.ChangePassword ($SecurePassword , $true , $true )
538
538
Write-Message - Level Verbose - Message " Login $loginName has been marked as must change password."
Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" {
190
190
It " Should not have same properties because of the overrides" {
191
191
192
192
$login1 = Get-DbaLogin - SqlInstance $TestConfig.instance1 - login claudio
193
- $login2 = Get-DbaLogin - SqlInstance $TestConfig.instance2 - login withMustChange
193
+ $login2 = Get-DbaLogin - SqlInstance $TestConfig.instance2 - login claudio
194
194
195
195
$login2 | Should Not BeNullOrEmpty
196
196
@@ -201,12 +201,11 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" {
201
201
$login1.IsDisabled | Should Not be $login2.IsDisabled
202
202
$login1.PasswordExpirationEnabled | Should Not be $login2.PasswordExpirationEnabled
203
203
$login1.PasswordPolicyEnforced | Should Not be $login2.PasswordPolicyEnforced
204
- $login1.MustChangePassword | Should Not be $login2.MustChangePassword
205
204
$login1.Sid | Should Not be $login2.Sid
206
205
}
207
206
if ($IsWindows -ne $false ) {
208
207
It " Should create a disabled account with deny Windows login" {
209
- $results = New-DbaLogin - SqlInstance $server1 - Login $winLogin - Disabled - DenyWindowsLogin
208
+ $results = New-DbaLogin - SqlInstance $server1 - Login $winLogin - Disabled - DenyWindowsLogin - Force
210
209
$results.Name | Should Be " $winLogin "
211
210
$results.DefaultDatabase | Should be ' master'
212
211
$results.IsDisabled | Should be $true
Original file line number Diff line number Diff line change @@ -35,7 +35,6 @@ $TestsRunGroups = @{
35
35
' Dismount-DbaDatabase' ,
36
36
# tests that fail locally against SQL Server 2022 instances and fail on AppVeyor
37
37
' Set-DbaAgentJobStep' ,
38
- ' New-DbaLogin' ,
39
38
' Watch-DbaDbLogin' ,
40
39
# tests that fail because the command does not work
41
40
' Copy-DbaDbCertificate' ,
You can’t perform that action at this time.
0 commit comments