< Back

Get-DbaDbccUserOption

Mon Jan 13, 2020 10:36 am

NAME Get-DbaDbccUserOption



SYNOPSIS

Execution of Database Console Command DBCC USEROPTIONS





SYNTAX

Get-DbaDbccUserOption [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>

[[-SqlCredential] <Pscredential>] [[-Option] <System.String[]>] [-EnableException <Switch>] [<CommonParameters>]





DESCRIPTION

Returns the results of DBCC USEROPTIONS



Read more:



- https://docs.microsoft.com/en-us/sql/t- ... ansact-sql





PARAMETERS

-EnableException [<Switch>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Option [<System.String[]>]

Return only specific options. Returns all results if not specified.

Accepts any values in set 'ansi_null_dflt_on', 'ansi_nulls', 'ansi_padding', 'ansi_warnings', 'arithabort',

'concat_null_yields_null', 'datefirst', 'dateformat', 'isolation level', 'language', 'lock_timeout',

'quoted_identifier', 'textsize'



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlCredential [<Pscredential>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]

The target SQL Server instance or instances.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Tags: DBCC

Author: Patrick Flynn (@sqllensman)



Website: https://dbatools.io

Copyright: (c) 2018 by dbatools, licensed under MIT

License: MIT https://opensource.org/licenses/MIT



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-DbaDbccUserOption -SqlInstance Server1



Get results of DBCC USEROPTIONS for Instance Server1

-------------------------- EXAMPLE 2 --------------------------



PS C:\\>'Sql1','Sql2/sqlexpress' | Get-DbaDbccUserOption



Get results of DBCC USEROPTIONS for Instances Sql1 and Sql2/sqlexpress

-------------------------- EXAMPLE 3 --------------------------



PS C:\\>$cred = Get-Credential sqladmin



PS C:\\> Get-DbaDbccUserOption -SqlInstance Server1 -SqlCredential $cred



Connects using sqladmin credential and gets results of DBCC USEROPTIONS for Instance Server1

-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-DbaDbccUserOption -SqlInstance Server1 -Option ansi_nulls, ansi_warnings, datefirst



Gets results of DBCC USEROPTIONS for Instance Server1. Only display results for the options ansi_nulls,

ansi_warnings, datefirst



RELATED LINKS

https://dbatools.io/Get-DbaDbccUserOption