Remove-OdbcDsn

Remove-OdbcDsn

Removes ODBC DSNs.

Sintaxis

Parameter Set: InputObject
Remove-OdbcDsn [-InputObject] <CimInstance[]> [-AsJob] [-CimSession <CimSession[]> ] [-PassThru] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: Name
Remove-OdbcDsn [-Name] <String> -DsnType <String> [-AsJob] [-CimSession <CimSession[]> ] [-DriverName <String> ] [-PassThru] [-Platform <String> ] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Descripción detallada

The Remove-OdbcDsn cmdlet removes Open Database Connectivity (ODBC) data source names (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/ms715383.aspx) on the Microsoft Developer Network.

Parámetros

-InputObject<CimInstance[]>

Specifies an array of input objects. This cmdlet removes the ODBC DSNs that the specified ODBC DSN objects represent. Specify a variable that contains the objects, or type a command or expression that gets the objects.

Alias

Dsn

¿Requerido?

true

¿Posición?

1

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByValue)

¿Aceptar caracteres comodín?

false

-Name<String>

Specifies the name of an ODBC DSNs. You can use wildcard characters to specify more than one name. This cmdlet removes the DSNs that the names specify.

Alias

DsnName

¿Requerido?

true

¿Posición?

1

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-DsnType<String>

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

-- User
-- System
-- All

Alias

ninguno

¿Requerido?

true

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-Platform<String>

Specifies the platform architecture. This cmdlet removes the ODBC DSNs 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 32-bit on a 32-bit process. The default value is 64-bit on a 64-bit process. 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 removes the ODBC DSN that uses the driver that this parameter specifies. You can use wildcard characters. If you do not specify this parameter, this cmdlet removes DSNs for all drivers.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-PassThru

Devuelve un objeto que representa el elemento con el que está trabajando. De forma predeterminada, este cmdlet no genera ningún resultado.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-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

Session

¿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

-Confirm

Solicita confirmación antes de ejecutar el cmdlet.

¿Requerido?

false

¿Posición?

named

Valor predeterminado

falso

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-WhatIf

Muestra lo que sucedería si se ejecutara el cmdlet. El cmdlet no se ejecuta.

¿Requerido?

false

¿Posición?

named

Valor predeterminado

falso

¿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: Remove 32-bit User DSNs that have names that contain a string

This command removes the 32-bit ODBC User DSNs that have names that contain Payroll.

PS C:\> Remove-OdbcDsn -Name "*Payroll*" -DsnType "User" -Platform "32-bit"

Example 2: Remove the System DSN named MyPayroll from the native platform

This command removes the ODBC System DSN named MyPayroll from the native platform.

PS C:\> Remove-OdbcDsn -Name "MyPayroll" -DsnType "System"

Example 3: Remove all 32-bit ODBC System DSNs by using wildcard characters

This command removes all 32-bit ODBC System DSNs that have names that contain the string *Payroll*, and use the driver with a name that starts with SQL Server.

PS C:\> Remove-OdbcDsn -Name "*Payroll*" -DsnType "System" -Platform "32-bit" -DriverName "SQL Server*"

Example 4: Remove a 32-bit ODBC User DSN by using a name

This command removes the 32-bit ODBC User DSNs named MyPayroll, and then stores the deleted DSN object in the $sysDsn variable.

PS C:\> $sysDsn = Remove-OdbcDsn -Name "MyPayroll" -DsnType "User" -Platform "32-bit" -PassThru

Example 5: Remove a System DSN on the native platform by using the pipeline operator

This command uses the Get-OdbcDsn to get the ODBC System DSN on the native platform named MyPayroll, and then passes it to the current cmdlet by using the pipeline operator. The example removes that DSN.

PS C:\> Get-OdbcDsn -Name "MyPayroll" -DsnType "System" | Remove-OdbcDsn

Example 6: Remove a ODBC System DSN on the native platform by using a variable

The first command uses Get-OdbcDsn to get the ODBC System DSN on the native platform named MyPayroll, and then stores it in the $dsnArray variable.

The second command removes the DSN stored in $dsnArray.

PS C:\> $dsnArray = Get-OdbcDsn -Name "MyPayroll" -DsnType "System"
PS C:\> Remove-OdbcDsn -InputObject $dsnArray 

Temas relacionados

Add-OdbcDsn

Get-OdbcDsn

Set-OdbcDsn

N:Wdac