Get-OdbcDsn

Get-OdbcDsn

Gets ODBC DSNs.

Sintaxis

Parameter Set: Get1
Get-OdbcDsn [[-Name] <String> ] [-AsJob] [-CimSession <CimSession> ] [-DriverName <String> ] [-DsnType <String> ] [-Platform <String> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Descripción detallada

The Get-OdbcDsn cmdlet gets Open Database Connectivity (ODBC) data source names (DSNs) from the computer. You can specify values for the Name, DsnType, Platform, and DriverName parameters. If you do not specify Name or DriverName, the cmdlet gets all DSN names and all driver names respectively. If you do not specify any parameter, the cmdlet gets all ODBC DSNs from the computer.

For more information about ODBC, data source names, and drivers, see Microsoft Open Database Connectivity (ODBC) (https://msdn.microsoft.com/en-us/library/ms710252.aspx), Data Sources (https://msdn.microsoft.com/en-us/library/ms711688.aspx), and Drivers (https://msdn.microsoft.com/en-us/library/ms711688.aspx) on the Microsoft Developer Network.

Parámetros

-Name<String>

Specifies the name of an ODBC DSN. You can use wildcard characters to specify more than one ODBC DSN. If you do not specify this parameter, this cmdlet returns all ODBC DSNs.

Alias

ninguno

¿Requerido?

false

¿Posición?

1

Valor predeterminado

ninguno

¿Aceptar canalización?

true (ByPropertyName)

¿Aceptar caracteres comodín?

true

-DsnType<String>

Specifies the type of an ODBC DSN. This cmdlet gets DSNs of the type that this parameter specifies. Los valores aceptables para este parámetro son los siguientes:

-- User
-- System
-- All

The default value is All.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

true (ByPropertyName)

¿Aceptar caracteres comodín?

false

-Platform<String>

Specifies the platform architecture. This cmdlet gets the ODBC DSN that belong to the architecture that this parameter specifies. Los valores aceptables para este parámetro son los siguientes:

-- 32-bit
-- 64-bit
-- All

The default value is All. If you run this cmdlet in a remote CIM session, this parameter refers to the platform architecture on the remote computer.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

true (ByPropertyName)

¿Aceptar caracteres comodín?

false

-DriverName<String>

Specifies the name of a driver. This cmdlet gets ODBC DSNs that use the specified ODBC driver. You can use wildcard characters. If you do not specify this parameter, this cmdlet gets all ODBC DSNs.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

true (ByPropertyName)

¿Aceptar caracteres comodín?

true

-AsJob

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-CimSession<CimSession>

Ejecuta el cmdlet en una sesión remota o en un equipo remoto. Escriba un nombre de equipo o un objeto de sesión, como la salida de un cmdlet New-CimSession o Get-CimSession. El valor predeterminado es la sesión actual en el equipo local.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-ThrottleLimit<Int32>

Especifica el número máximo de operaciones simultáneas que se pueden establecer para ejecutar el cmdlet. Si se omite este parámetro o es especifica un valor de 0, Windows PowerShell ® calcula un límite óptimo para el cmdlet en función del número de cmdlets de CIM que se estén ejecutando en el equipo. El límite solo se aplica al cmdlet actual, no a la sesión ni al equipo.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

<CommonParameters>

Este cmdlet admite los siguientes parámetros comunes: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer y -OutVariable. Para obtener más información, consulte about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Entradas

El tipo de entrada es el tipo de los objetos que se pueden canalizar al cmdlet.

Salidas

El tipo de resultado es el tipo de objetos que emite el cmdlet.

  • Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDsn[]

Ejemplos

Example 1: Get all DSNs

This command gets all ODBC User DSNs and System DSNs that use 32-bit or 64-bit ODBC drivers.

PS C:\> Get-OdbcDsn

Example 2: Get ODBC System DSNs by name

This command gets the ODBC System DSNs named MyPayroll stored in the 32-bit registry location.

PS C:\> Get-OdbcDsn -Name "MyPayroll" -DsnType "System" -Platform "32-bit"

Example 3: Get ODBC DSNs with names that contain a string

This command gets all ODBC User DSNs and System DSNs with names that contain the string Payroll. The DSNs are stored in the native hive of the registry location.

PS C:\> Get-OdbcDsn -Name "*Payroll*"

Example 4: Get all ODBC User DSNs for specified driver

This command gets all ODBC User DSNs that use a driver that has the specified name, and then stores those DSN in the $dsnArray variable.

PS C:\> $dsnArray = Get-OdbcDsn -DriverName "SQL Server*"

Temas relacionados

Add-OdbcDsn

Remove-OdbcDsn

Set-OdbcDsn

N:Wdac