@@ -467,7 +467,11 @@ function NewGet-AllInstanceInfo {
467
467
$lastlogin = @ {Name = ' LastLogin' ; Expression = { $Name = $_.name ; ($loginTimes | Where-Object { $_.login_name -eq $name }).login_time
468
468
}
469
469
}
470
- $LoginMustChangeCount = ($Instance.Logins | Where-Object { $_.Name -in $Instance.Roles [' sysadmin' ].EnumMemberNames() } | Select-Object Name, $lastlogin , MustChangePassword, IsDisabled | Where-Object { $_.MustChangePassword -eq $false -and $_.IsDisabled -eq $false -and $null -eq $_.LastLogin }).Count
470
+ $LoginMustChangeCount = ($Instance.Logins | Where-Object { $_.LoginType -eq ' SqlLogin' } | Where-Object { $_.Name -in $Instance.Roles [' sysadmin' ].EnumMemberNames() } | Select-Object Name, $lastlogin , MustChangePassword, IsDisabled | Where-Object { $_.MustChangePassword -eq $false -and $_.IsDisabled -eq $false -and $null -eq $_.LastLogin }).Count
471
+ }
472
+
473
+ ' LoginPasswordExpiration' {
474
+ $LoginPasswordExpirationCount = ($Instance.Logins | Where-Object { $_.Name -in $Instance.Roles [' sysadmin' ].EnumMemberNames() } | Where-Object { $_.LoginType -eq ' SqlLogin' -and $_.PasswordExpirationEnabled -EQ $false -and $_.IsDisabled -EQ $false }).Count
471
475
}
472
476
473
477
Default { }
@@ -476,20 +480,20 @@ function NewGet-AllInstanceInfo {
476
480
# build the object
477
481
478
482
$testInstanceObject = [PSCustomObject ]@ {
479
- ComputerName = $Instance.ComputerName
480
- InstanceName = $Instance.DbaInstanceName
481
- Name = $Instance.Name
482
- ConfigValues = $ConfigValues
483
- VersionMajor = $Instance.VersionMajor
484
- Configuration = if ($configurations ) { $Instance.Configuration } else { $null }
485
- Settings = $Instance.Settings
486
- Logins = $Instance.Logins
487
- Databases = $Instance.Databases
488
- NumberOfLogFiles = $Instance.NumberOfLogFiles
489
- MaxDopSettings = $MaxDopSettings
490
- ExpectedTraceFlags = $ExpectedTraceFlags
491
- NotExpectedTraceFlags = $NotExpectedTraceFlags
492
- XESessions = [pscustomobject ]@ {
483
+ ComputerName = $Instance.ComputerName
484
+ InstanceName = $Instance.DbaInstanceName
485
+ Name = $Instance.Name
486
+ ConfigValues = $ConfigValues
487
+ VersionMajor = $Instance.VersionMajor
488
+ Configuration = if ($configurations ) { $Instance.Configuration } else { $null }
489
+ Settings = $Instance.Settings
490
+ Logins = $Instance.Logins
491
+ Databases = $Instance.Databases
492
+ NumberOfLogFiles = $Instance.NumberOfLogFiles
493
+ MaxDopSettings = $MaxDopSettings
494
+ ExpectedTraceFlags = $ExpectedTraceFlags
495
+ NotExpectedTraceFlags = $NotExpectedTraceFlags
496
+ XESessions = [pscustomobject ]@ {
493
497
RequiredStopped = $RequiredStopped.ForEach {
494
498
[pscustomobject ]@ {
495
499
Name = $Instance.Name
@@ -524,23 +528,23 @@ function NewGet-AllInstanceInfo {
524
528
Sessions = $Sessions
525
529
Running = $RunningSessions
526
530
}
527
- ErrorLogEntries = [pscustomobject ]@ {
531
+ ErrorLogEntries = [pscustomobject ]@ {
528
532
errorLogCount = $ErrorLogCount
529
533
logWindow = $logWindow
530
534
}
531
- InstanceConnection = $InstanceConnection
532
- BackupPathAccess = [pscustomobject ]@ {
535
+ InstanceConnection = $InstanceConnection
536
+ BackupPathAccess = [pscustomobject ]@ {
533
537
Result = $BackupPathAccess
534
538
BackupPath = $BackupPath
535
539
}
536
- LatestBuild = [PSCustomObject ]@ {
540
+ LatestBuild = [PSCustomObject ]@ {
537
541
Compliant = $LatestBuild.Compliant
538
542
}
539
- NetworkLatency = [PSCustomObject ]@ {
543
+ NetworkLatency = [PSCustomObject ]@ {
540
544
Latency = $Latency
541
545
Threshold = $NetworkThreshold
542
546
}
543
- LinkedServerResults = if ($LinkedServerResults ) {
547
+ LinkedServerResults = if ($LinkedServerResults ) {
544
548
$LinkedServerResults.ForEach {
545
549
[pscustomobject ]@ {
546
550
InstanceName = $Instance.Name
@@ -559,20 +563,21 @@ function NewGet-AllInstanceInfo {
559
563
Result = ' None'
560
564
}
561
565
}
562
- MaxMemory = $MaxMemory
563
- OrphanedFile = [pscustomobject ]@ {
566
+ MaxMemory = $MaxMemory
567
+ OrphanedFile = [pscustomobject ]@ {
564
568
FileCount = $FileCount
565
569
}
566
- ServerNameMatch = [pscustomobject ]@ {
570
+ ServerNameMatch = [pscustomobject ]@ {
567
571
configuredServerName = $ServerNameMatchconfiguredServerName
568
572
netName = $ServerNameMatchnetName
569
573
renamerequired = $ServerNameMatchrenamerequired
570
574
}
571
- MemoryDump = $Dump
572
- HideInstance = $HideInstance
573
- SuspectPageCountResult = $SuspectPageCountResult
574
- SupportedBuild = $SupportedBuild
575
- LoginMustChangeCount = $LoginMustChangeCount
575
+ MemoryDump = $Dump
576
+ HideInstance = $HideInstance
577
+ SuspectPageCountResult = $SuspectPageCountResult
578
+ SupportedBuild = $SupportedBuild
579
+ LoginMustChangeCount = $LoginMustChangeCount
580
+ LoginPasswordExpirationCount = $LoginPasswordExpirationCount
576
581
# TempDbConfig = [PSCustomObject]@{
577
582
# TF118EnabledCurrent = $tempDBTest[0].CurrentSetting
578
583
# TF118EnabledRecommended = $tempDBTest[0].Recommended
0 commit comments