File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed
source/internal/functions Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -507,9 +507,42 @@ function NewGet-AllInstanceInfo {
507
507
}
508
508
509
509
' SqlEngineServiceAccount' {
510
- $EngineAccounts = Get-DbaService - ComputerName $psitem - Type Engine - ErrorAction SilentlyContinue
511
510
$starttype = ($__dbcconfig | Where-Object { $_.Name -eq ' policy.instance.sqlenginestart' }).Value
512
511
$state = ($__dbcconfig | Where-Object { $_.Name -eq ' policy.instance.sqlenginestate' }).Value
512
+ try {
513
+ $EngineAccounts = Get-DbaService - ComputerName $psitem - Type Engine - ErrorAction Stop
514
+
515
+ } catch [System.Exception ] {
516
+ if ($_.Exception.Message -like ' *No services found in relevant namespaces*' ) {
517
+ $EngineAccounts = [PSCustomObject ]@ {
518
+ InstanceName = $Instance.Name
519
+ State = ' unknown'
520
+ ExpectedState = $state
521
+ StartType = ' unknown'
522
+ ExpectedStartType = $starttype
523
+ because = ' Some sort of failure - No services found in relevant namespaces'
524
+ }
525
+ } else {
526
+ $EngineAccounts = [PSCustomObject ]@ {
527
+ InstanceName = $Instance.Name
528
+ State = ' unknown'
529
+ ExpectedState = $state
530
+ StartType = ' unknown'
531
+ ExpectedStartType = $starttype
532
+ because = ' Some sort of failure'
533
+ }
534
+ }
535
+ } catch {
536
+ $EngineAccounts = [PSCustomObject ]@ {
537
+ InstanceName = $Instance.Name
538
+ State = ' unknown'
539
+ ExpectedState = $state
540
+ StartType = ' unknown'
541
+ ExpectedStartType = $starttype
542
+ because = ' We Could not Connect to $Instance $ComputerName , $InstanceName from catch'
543
+ }
544
+ }
545
+
513
546
if ($Instance.IsClustered ) {
514
547
$starttype = ' Manual'
515
548
$because = ' This is a clustered instance and Clustered Instances required that the SQL engine service is set to manual'
You can’t perform that action at this time.
0 commit comments