Get-SqlDatabase

Gets an SMO Database object.

Syntax

Get-SqlDatabase [-sqlserver] <Object> [[-dbname] <String>] [[-force]] [<CommonParameters>]

Detailed Description

The Get-SqlDatabase function gets an SMO Database object for the specified SQL Database or collection of Database objects.

Related Commands

* Get-SqlDatabase

Parameters

Name Description Required? Pipeline Input Default Value
sqlserver    true  false   
dbname    false  false   
force    false  false   

Input Type

None You cannot pipe objects to Get-SqlDatabase

Return Values

Microsoft.SqlServer.Management.Smo.Database Get-SqlDatabase returns a Microsoft.SqlServer.Management.Smo.Database object.

Examples

EXAMPLE 1

Get-SqlDatabase "Z002\sql2K8"
This command gets a collection of SMO Database objects for SQL Server Z002\SQL2K8.

EXAMPLE 2

Get-SqlDatabase $(Get-SqlServer "Z002\sql2K8" "sa" "Passw0rd") "pubs"
This command gets a SMO Database object for SQL database pubs on the SQL Server Z002\SQL2K8 using SQL authentication.