--- title: "Get-VESQLPublishedDatabase" description: "Returns published Microsoft SQL Server databases. Product: Veeam Backup & Replication Product Edition: Community, Standard, Enterprise, Enterprise Plus, Veeam Universal License This cmdlet returns an array of published Microsoft SQL Server databa" canonical: "https://helpcenter.veeam.com/docs/vbr/explorers_powershell/get-vesqlpublisheddatabase.html" breadcrumb: "Veeam Explorers PowerShell Reference > Veeam Explorers PowerShell Reference > Veeam Explorer for Microsoft SQL Server > Get-VESQLPublishedDatabase" dateModified: "2026-08-18" --- # Get-VESQLPublishedDatabase ## Short Description Returns published Microsoft SQL Server databases. **Product**: Veeam Backup & Replication **Product Edition**: Community, Standard, Enterprise, Enterprise Plus, Veeam Universal License ## Syntax ``` Get-VESQLPublishedDatabase [-Session] [[-Name] ] [-ServerName ] [-InstanceName ] [] ``` ## Detailed Description This cmdlet returns an array of published Microsoft SQL Server databases. ::: note The cmdlet returns Microsoft SQL Server databases published in the PowerShell console only. The cmdlet does not return Microsoft SQL Server databases published in the Veeam Backup & Replication console. ::: ## Parameters

Parameter

Description

Type

Required

Position

Accept Pipeline Input

InstanceName

Specifies an array of target instance names. The cmdlet will get Microsoft SQL Server databases that are published to these instances.

String[]

False

Named

False

Name

Specifies an array of names for Microsoft SQL Server databases. The cmdlet will return information about databases with the specified names.

String[]

False

1

False

ServerName

Specifies an array of target server names (as DNS names or IP addresses). The cmdlet will get Microsoft SQL Server databases that are published to these servers.

String[]

False

Named

False

Session

Specifies a restore session. The cmdlet will return information about Microsoft SQL Server databases added to the specified restore session.

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

IVESQLRestoreSession

True

0

True (ByValue)

`` This cmdlet supports Microsoft PowerShell common parameters. For more information on common parameters, see the [About Common Parameters](http://go.microsoft.com/fwlink/p/?LinkID=113216) section of Microsoft Docs. ## Output Object The cmdlet returns the [`VESQLPublishedDatabase`](vesqlpublisheddatabase.md)`[]` array that contains published Microsoft SQL Server databases. ## Examples ::: example ### Example 1. Getting all Published Microsoft SQL Server Databases This example shows how to get an array of all published Microsoft SQL Server databases within a restore session. ``` $session = Get-VESQLRestoreSession Get-VESQLPublishedDatabase -Session $session[0] ``` Perform the following steps: 1. Run the `Get-VESQLRestoreSession` cmdlet. Save the result to the `$session` variable. The cmdlet will return an array of restore sessions. Note the ordinal number of the necessary restore session. In this example, it is the first restore session in the array. 2. Run the `Get-VESQLPublishedDatabase` cmdlet. Set the `$session` variable as the `Session` parameter value and select the necessary restore session. ::: ::: example ### Example 2. Getting All Published Microsoft SQL Server Databases with Specific Names Belonging to Specific Instances This example shows how to get an array of published Microsoft SQL Server databases with specific names belonging to specific instances on the backup file. ``` $session = Get-VESQLRestoreSession $dbnames = @("db1", "db2") $instancenames = @("instance_01", "instance_02") $database = Get-VESQLPublishedDatabase -Session $session[0] -Name $dbnames -InstanceName $instancenames ``` Perform the following steps: 1. Run the `Get-VESQLRestoreSession` cmdlet. Save the result to the `$session` variable. The cmdlet will return an array of restore sessions. Note the ordinal number of the necessary restore session. In this example, it is the first restore session in the array. 2. Declare the `$dbnames` variable. Assign to this variable an array with the names of the necessary Microsoft SQL Server databases. 3. Declare the `$instancenames` variable. Assign to this variable an array with the names of the Microsoft SQL Server instances that you want to query. 4. Run the `Get-VESQLPublishedDatabase` cmdlet. Specify the following settings: - Set the `$session` variable as the `Session` parameter value and select the necessary restore session. - Set the `$dbnames` variable as the `Name` parameter value. - Set the `$instancenames` variable as the `InstanceName` parameter value. Save the result to the `$database` variable to be able to use it with other cmdlets. ::: ::: example ### Example 3. Getting All Microsoft SQL Server Databases Published on Specific Servers This example shows how to get an array of all Microsoft SQL Server databases published on the specified servers. ``` $session = Get-VESQLRestoreSession $servernames = @("dlsql01", "dlsql02") $database = Get-VESQLPublishedDatabase -Session $session[0] -ServerName $servernames ``` Perform the following steps: 1. Run the `Get-VESQLRestoreSession` cmdlet. Save the result to the `$session` variable. The cmdlet will return an array of restore sessions. Note the ordinal number of the necessary restore session. In this example, it is the first restore session in the array. 2. Declare the `$servernames` variable. Assign to this variable an array with the names of the necessary servers with Microsoft SQL Server. 3. Run the `Get-VESQLPublishedDatabase` cmdlet. Set the `$session` variable as the Session parameter value and select the necessary restore session. Set the `$servernames` variable as the `ServerName` parameter value. Save the result to the `$database` variable to be able to use it with other cmdlets. ::: ## Related Commands [`Get-VESQLRestoreSession`](get-vesqlrestoresession.md)