@@ -216,6 +216,11 @@ function Restore-DbaDatabase {
216216 Use this when restoring databases with CDC enabled and you need to maintain change tracking functionality.
217217 Cannot be combined with NoRecovery or Standby modes as CDC requires the database to be fully recovered.
218218
219+ . PARAMETER ErrorBrokerConversations
220+ Ends all conversations in the database with an error message when restoring, using the ERROR_BROKER_CONVERSATIONS option.
221+ Use this when you want to clean up Service Broker conversations that may be left in an inconsistent state after a restore.
222+ Only applied during the final restore step (WITH RECOVERY), not during intermediate log restores.
223+
219224 . PARAMETER KeepReplication
220225 Maintains replication settings and objects when restoring databases involved in replication topologies.
221226 Use this when restoring publisher or subscriber databases where you need to preserve replication configuration.
@@ -485,6 +490,7 @@ function Restore-DbaDatabase {
485490 [parameter (ParameterSetName = " Restore" )][string ]$DestinationFileSuffix ,
486491 [parameter (ParameterSetName = " Recovery" )][switch ]$Recover ,
487492 [parameter (ParameterSetName = " Restore" )][switch ]$KeepCDC ,
493+ [parameter (ParameterSetName = " Restore" )][switch ]$ErrorBrokerConversations ,
488494 [string ]$GetBackupInformation ,
489495 [switch ]$StopAfterGetBackupInformation ,
490496 [string ]$SelectBackupInformation ,
@@ -873,28 +879,29 @@ function Restore-DbaDatabase {
873879 }
874880 try {
875881 $parms = @ {
876- SqlInstance = $RestoreInstance
877- WithReplace = $WithReplace
878- RestoreTime = $RestoreTime
879- StandbyDirectory = $StandbyDirectory
880- NoRecovery = $NoRecovery
881- Continue = $Continue
882- OutputScriptOnly = $OutputScriptOnly
883- BlockSize = $BlockSize
884- MaxTransferSize = $MaxTransferSize
885- BufferCount = $Buffercount
886- KeepCDC = $KeepCDC
887- VerifyOnly = $VerifyOnly
888- PageRestore = $PageRestore
889- StorageCredential = $StorageCredential
890- KeepReplication = $KeepReplication
891- StopMark = $StopMark
892- StopAfterDate = $StopAfterDate
893- StopBefore = $StopBefore
894- ExecuteAs = $ExecuteAs
895- Checksum = $Checksum
896- Restart = $Restart
897- EnableException = $true
882+ SqlInstance = $RestoreInstance
883+ WithReplace = $WithReplace
884+ RestoreTime = $RestoreTime
885+ StandbyDirectory = $StandbyDirectory
886+ NoRecovery = $NoRecovery
887+ Continue = $Continue
888+ OutputScriptOnly = $OutputScriptOnly
889+ BlockSize = $BlockSize
890+ MaxTransferSize = $MaxTransferSize
891+ BufferCount = $Buffercount
892+ KeepCDC = $KeepCDC
893+ ErrorBrokerConversations = $ErrorBrokerConversations
894+ VerifyOnly = $VerifyOnly
895+ PageRestore = $PageRestore
896+ StorageCredential = $StorageCredential
897+ KeepReplication = $KeepReplication
898+ StopMark = $StopMark
899+ StopAfterDate = $StopAfterDate
900+ StopBefore = $StopBefore
901+ ExecuteAs = $ExecuteAs
902+ Checksum = $Checksum
903+ Restart = $Restart
904+ EnableException = $true
898905 }
899906 $FilteredBackupHistory | Where-Object { $_.IsVerified -eq $true } | Invoke-DbaAdvancedRestore @parms
900907 } catch {
0 commit comments