Restore SQL database to Availability Group

  • 2 April 2024
  • 2 replies

Userlevel 1
Badge +5

via Command Center it is not possible to restore a SQL-database “in place” to an availability group.


Does anybody have a workflow or Powershell-Script that can remove the database from the availability group before the restore … and back to the availability group after the restore?


Any help is very much appreciated.


Best regards.




Best answer by Albert Williams 3 April 2024, 02:37

View original

2 replies

Userlevel 6
Badge +14

Hello @Michael Seickert 

Thanks for the great question!
In regards to your question you can use the Pre/post script option if you build your own PowerShell script to run.

The following commands are ones that can be used in that script: 

Remove Database:

Add Database:

Kind regards
Albert Williams

Userlevel 1
Badge +5

Hi Albert,


This was exactly, what I am was looking for. I will try this.


Thank you.


Best regards.