File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# sqmSQLTool — Changelog
22
3+ ## [ 1.6.1.0] — 2026-06-22
4+
5+ ### 🔧 Fixes
6+
7+ - ** Invoke-sqmRestoreDatabase** : Brach bei existierender Ziel-Datenbank mit
8+ „A parameter cannot be found that matches parameter name 'Database'" ab. Ursache war
9+ ` Get-DbaAvailabilityGroup -Database ` (diesen Parameter gibt es nicht; der Parameter-Binding-Fehler
10+ ist terminierend und wird von ` -ErrorAction SilentlyContinue ` nicht abgefangen). AG-Mitgliedschaft
11+ wird jetzt über ` Get-DbaAgDatabase ` geprüft, das AG-Objekt über den AG-Namen nachgeladen.
12+ - ** Invoke-sqmLogging** : ` -WhatIf ` des Aufrufers leakte über ` $WhatIfPreference ` in die
13+ internen ` Out-File ` /` New-Item ` -Aufrufe und erzeugte „What if: Output to File"-Rauschen, während
14+ gar kein Log geschrieben wurde. Beide Aufrufe laufen jetzt mit ` -WhatIf:$false ` (Logging ist ein
15+ Seitenkanal und darf nicht unter ShouldProcess fallen).
16+
317## [ 1.6.0.0] — 2026-06-21
418
519### ✨ Neu
Original file line number Diff line number Diff line change @@ -38,15 +38,18 @@ function Invoke-sqmLogging
3838 # Sicherstellung dass LogPath existiert (könnte nach Modulimport gelöscht worden sein)
3939 if (-not (Test-Path $logPath - PathType Container))
4040 {
41- New-Item - ItemType Directory - Path $logPath - Force - ErrorAction Stop | Out-Null
41+ # -WhatIf:$false: Logging ist ein Seitenkanal und darf nicht unter ShouldProcess
42+ # fallen. Sonst leakt ein -WhatIf des Aufrufers (via $WhatIfPreference) hier herein
43+ # und erzeugt "What if: Output to File"-Rauschen statt zu schreiben.
44+ New-Item - ItemType Directory - Path $logPath - Force - ErrorAction Stop - WhatIf:$false | Out-Null
4245 }
4346
4447 $dateStamp = Get-Date - Format " yyyyMMdd"
4548 $fileName = " sqmSQLTool_$ ( $dateStamp ) _$ ( $FunctionName ) .log"
4649 $fullPath = Join-Path $logPath $fileName
4750
4851 $timestamp = Get-Date - Format " HH:mm:ss"
49- " [$timestamp ] [$Level ] $Message " | Out-File - FilePath $fullPath - Append - Encoding UTF8 - ErrorAction Stop
52+ " [$timestamp ] [$Level ] $Message " | Out-File - FilePath $fullPath - Append - Encoding UTF8 - ErrorAction Stop - WhatIf: $false
5053 }
5154 catch
5255 {
Original file line number Diff line number Diff line change @@ -229,12 +229,17 @@ function Invoke-sqmRestoreDatabase
229229 {
230230 Invoke-sqmLogging - Message " Datenbank '$DatabaseName ' existiert auf $SqlInstance ." - FunctionName $functionName - Level " INFO"
231231
232- # Pruefen, ob die Datenbank in einer AG ist
233- $agCheck = Get-DbaAvailabilityGroup - SqlInstance $SqlInstance - SqlCredential $SqlCredential - Database $DatabaseName - ErrorAction SilentlyContinue
234- if ($agCheck )
232+ # Pruefen, ob die Datenbank in einer AG ist.
233+ # WICHTIG: Get-DbaAvailabilityGroup hat KEINEN -Database-Parameter. Ein -Database loest einen
234+ # terminierenden Parameter-Binding-Fehler aus, den -ErrorAction SilentlyContinue NICHT abfaengt.
235+ # Daher Mitgliedschaft ueber Get-DbaAgDatabase pruefen und das AG-Objekt (mit .Name) anschliessend
236+ # ueber den AG-Namen nachladen.
237+ $agDbCheck = Get-DbaAgDatabase - SqlInstance $SqlInstance - SqlCredential $SqlCredential - Database $DatabaseName - ErrorAction SilentlyContinue
238+ if ($agDbCheck )
235239 {
236240 $isAGDatabase = $true
237- $availabilityGroup = $agCheck
241+ $agName = ($agDbCheck | Select-Object - First 1 ).AvailabilityGroup
242+ $availabilityGroup = Get-DbaAvailabilityGroup - SqlInstance $SqlInstance - SqlCredential $SqlCredential - AvailabilityGroup $agName - ErrorAction SilentlyContinue
238243 Invoke-sqmLogging - Message " Datenbank ist Mitglied der AG '$ ( $availabilityGroup.Name ) '." - FunctionName $functionName - Level " INFO"
239244 if (-not $KeepAlwaysOn )
240245 {
Original file line number Diff line number Diff line change 1717 RootModule = ' sqmSQLTool.psm1'
1818
1919 # Version number of this module.
20- ModuleVersion = ' 1.6.0 .0'
20+ ModuleVersion = ' 1.6.1 .0'
2121
2222 # ID used to uniquely identify this module
2323 GUID = ' c4b10ba2-aee2-4d8d-ad86-a6e97c346ba6'
243243 # IconUri = ''
244244
245245 # ReleaseNotes of this module
246- ReleaseNotes = ' See CHANGELOG.md and GitHub: https://github.com/JankeUwe/sqmSQLTool/releases/tag/v1.6.0 .0'
246+ ReleaseNotes = ' See CHANGELOG.md and GitHub: https://github.com/JankeUwe/sqmSQLTool/releases/tag/v1.6.1 .0'
247247
248248 # External module dependencies
249249 ExternalModuleDependencies = @ (' dbatools' )
You can’t perform that action at this time.
0 commit comments