Short Description

Modifies switchover settings for a specified Microsoft SQL Server database.

Applies to

Veeam Backup & Replication

Product Edition: Enterprise, Enterprise Plus, Veeam Universal License


Set-VESQLIRDatabase [-Database] <VESQLIRDatabase> [-SwitchOverOptions] <VESQLIRSwitchOverOptions> [<CommonParameters>]

Detailed Description

This cmdlet allows you to modify the switchover settings for a specified Microsoft SQL Server database.

Set-VESQLIRDatabase Important!

You can only modify the switchover settings until the moment switchover is automatically triggered (if the Auto or Scheduled switchover options are selected).







Accept Pipeline Input


Specifies a published Microsoft SQL Server database within an instant recovery session.

Accepts the VESQLIRDatabase object. To get this object, run the Get-VESQLIRDatabase cmdlet.



True (ByValue)


Specified a new switchover option for the specified Microsoft SQL Server database.

Accepts the VESQLIRSwitchOverOptions object. To create this object, run the New-VESQLIRSwitchOverOptions cmdlet.



True (ByValue)


This cmdlet supports Microsoft PowerShell common parameters. For more information on common parameters, see the About CommonParameters section of Microsoft Docs.


Setting Scheduled Switchover for Microsoft SQL Server Database

This example shows how to set scheduled switchover for the fiscal database. The switchover will be performed on 2023-12-4 at 13:00:00.

$time = Get-Date -Date "2023-12-4 13:00:00"

$TimeUtc = $time.ToUniversalTime()

$ScheduledSwitch = New-VESQLIRSwitchOverOptions -Scheduled -SwitchingTimeUtc $TimeUtc

$IRDatabase = Get-VESQLIRDatabase -DatabaseName "fiscal"

Set-VESQLIRDatabase -Database $IRDatabase -SwitchOverOptions $ScheduledSwitch

Perform the following steps:

  1. Run the Get-Date cmdlet and specify the date and time when the switchover must be performed. Save the result to the $time variable.
  2. Use the ToUniversalTime() method to convert the date and time to the UTC format. Save the result to the $TimeUTC variable.
  3. Run the New-VESQLIRSwitchoverOptions cmdlet. Provide the Scheduled parameter. Set the $TimeUTC variable as the SwitchingTimeUtc parameter value. Save the result to the $ScheduledSwitch variable.
  4. Run the Get-VESQLIRDatabase cmdlet. Specify the DatabaseName parameter value. Save the result to the $IRDatabase variable.
  5. Run the Set-VESQLIRDatabase cmdlet. Specify the following options:
  • Set the $IRDatabase as the Database parameter value.
  • Set the $ScheduledSwitch as the SwitchOverOptions parameter value.

Related Commands