commands

^

Get-DbaInstanceProperty

Author Klaas Vandenberghe (@powerdbaklaas)
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Get-DbaInstanceProperty on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaInstanceProperty.

Synopsis

Gets SQL Server instance properties of one or more instance(s) of SQL Server.

Description

The Get-DbaInstanceProperty command gets SQL Server instance properties from the SMO object sqlserver.

Syntax

Get-DbaInstanceProperty
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-SqlCredential] <PSCredential>]
    [[-InstanceProperty] <Object[]>]
    [[-ExcludeInstanceProperty] <Object[]>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaInstanceProperty -SqlInstance localhost

Returns SQL Server instance properties on the local default SQL Server instance

Example: 2
PS C:\> Get-DbaInstanceProperty -SqlInstance sql2, sql4\sqlexpress

Returns SQL Server instance properties on default instance on sql2 and sqlexpress instance on sql4

Example: 3
PS C:\> 'sql2','sql4' | Get-DbaInstanceProperty

Returns SQL Server instance properties on sql2 and sql4

Example: 4
PS C:\> Get-DbaInstanceProperty -SqlInstance sql2,sql4 -InstanceProperty DefaultFile

Returns SQL Server instance property DefaultFile on instance sql2 and sql4

Example: 5
PS C:\> Get-DbaInstanceProperty -SqlInstance sql2,sql4 -ExcludeInstanceProperty DefaultFile

Returns all SQL Server instance properties except DefaultFile on instance sql2 and sql4

Example: 6
PS C:\> $cred = Get-Credential sqladmin
PS C:\> Get-DbaInstanceProperty -SqlInstance sql2 -SqlCredential $cred

Connects using sqladmin credential and returns SQL Server instance properties from sql2

Required Parameters

-SqlInstance

The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.

Alias
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-SqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.

Alias
Required False
Pipeline false
Default Value
-InstanceProperty

SQL Server instance property(ies) to include.

Alias
Required False
Pipeline false
Default Value
-ExcludeInstanceProperty

SQL Server instance property(ies) to exclude.

Alias
Required False
Pipeline false
Default Value
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False