@@ -49,7 +49,32 @@ Describe 'Complete-SqlDscImage' -Tag @('Integration_SQL2017', 'Integration_SQL20
4949 Force = $true
5050 }
5151
52- $null = Complete-SqlDscImage @completeSqlDscImageParameters
52+ try
53+ {
54+ $null = Complete-SqlDscImage @completeSqlDscImageParameters
55+ }
56+ catch
57+ {
58+ # Output Summary.txt if it exists to help diagnose the failure
59+ $summaryFiles = Get-ChildItem - Path ' C:\Program Files\Microsoft SQL Server' - Filter ' Summary.txt' - Recurse - ErrorAction SilentlyContinue |
60+ Where-Object { $_.FullName -match ' \\Setup Bootstrap\\Log\\' } |
61+ Sort-Object - Property LastWriteTime - Descending |
62+ Select-Object - First 1
63+
64+ if ($summaryFiles )
65+ {
66+ Write-Verbose " ==== SQL Server Setup Summary.txt (from $ ( $summaryFiles.FullName ) ) ====" - Verbose
67+ Get-Content - Path $summaryFiles.FullName | Write-Verbose - Verbose
68+ Write-Verbose " ==== End of Summary.txt ====" - Verbose
69+ }
70+ else
71+ {
72+ Write-Verbose ' No Summary.txt file found.' - Verbose
73+ }
74+
75+ # Re-throw the original error
76+ throw $_
77+ }
5378 }
5479 }
5580
@@ -77,7 +102,32 @@ Describe 'Complete-SqlDscImage' -Tag @('Integration_SQL2017', 'Integration_SQL20
77102 Force = $true
78103 }
79104
80- $null = Complete-SqlDscImage @completeSqlDscImageParameters
105+ try
106+ {
107+ $null = Complete-SqlDscImage @completeSqlDscImageParameters
108+ }
109+ catch
110+ {
111+ # Output Summary.txt if it exists to help diagnose the failure
112+ $summaryFiles = Get-ChildItem - Path ' C:\Program Files\Microsoft SQL Server' - Filter ' Summary.txt' - Recurse - ErrorAction SilentlyContinue |
113+ Where-Object { $_.FullName -match ' \\Setup Bootstrap\\Log\\' } |
114+ Sort-Object - Property LastWriteTime - Descending |
115+ Select-Object - First 1
116+
117+ if ($summaryFiles )
118+ {
119+ Write-Verbose " ==== SQL Server Setup Summary.txt (from $ ( $summaryFiles.FullName ) ) ====" - Verbose
120+ Get-Content - Path $summaryFiles.FullName | Write-Verbose - Verbose
121+ Write-Verbose " ==== End of Summary.txt ====" - Verbose
122+ }
123+ else
124+ {
125+ Write-Verbose ' No Summary.txt file found.' - Verbose
126+ }
127+
128+ # Re-throw the original error
129+ throw $_
130+ }
81131 }
82132 }
83133
@@ -101,7 +151,32 @@ Describe 'Complete-SqlDscImage' -Tag @('Integration_SQL2017', 'Integration_SQL20
101151 Force = $true
102152 }
103153
104- $null = Complete-SqlDscImage @completeSqlDscImageParameters
154+ try
155+ {
156+ $null = Complete-SqlDscImage @completeSqlDscImageParameters
157+ }
158+ catch
159+ {
160+ # Output Summary.txt if it exists to help diagnose the failure
161+ $summaryFiles = Get-ChildItem - Path ' C:\Program Files\Microsoft SQL Server' - Filter ' Summary.txt' - Recurse - ErrorAction SilentlyContinue |
162+ Where-Object { $_.FullName -match ' \\Setup Bootstrap\\Log\\' } |
163+ Sort-Object - Property LastWriteTime - Descending |
164+ Select-Object - First 1
165+
166+ if ($summaryFiles )
167+ {
168+ Write-Verbose " ==== SQL Server Setup Summary.txt (from $ ( $summaryFiles.FullName ) ) ====" - Verbose
169+ Get-Content - Path $summaryFiles.FullName | Write-Verbose - Verbose
170+ Write-Verbose " ==== End of Summary.txt ====" - Verbose
171+ }
172+ else
173+ {
174+ Write-Verbose ' No Summary.txt file found.' - Verbose
175+ }
176+
177+ # Re-throw the original error
178+ throw $_
179+ }
105180 }
106181 }
107182}
0 commit comments