This is the built-in help made by Microsoft for the command 'Remove-OdbcDsn', in PowerShell version 4 - as retrieved from
Windows version 'Microsoft Windows 8.1 Enterprise' PowerShell help files on 2016-06-23.
For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.
Removes ODBC DSNs.
Remove-OdbcDsn [-InputObject] <CimInstance[]> [-AsJob] [-CimSession <CimSession[]>] [-PassThru] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-OdbcDsn [-Name] <String> [-AsJob] [-CimSession <CimSession[]>] [-DriverName <String>] [-PassThru] [-Platform <String>] [-ThrottleLimit <Int32>] -DsnType <Strin
g> [-Confirm] [-WhatIf] [<CommonParameters>]
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) (http://msdn.microsoft.com/en-us/library/ms710252.asp
x), Data Sources (http://msdn.microsoft.com/en-us/library/ms711688.aspx), and Drivers (http://msdn.microsoft.com/en-us/library/ms715383.aspx) on the Microsoft Develop
er Network.
<
Online Version: http://go.microsoft.com/fwlink/p/?linkid=287609
Add-OdbcDsn
Get-OdbcDsn
Set-OdbcDsn
N:Wdac
<
Example 1: Remove 32-bit User DSNs that have names that contain a string
PS C:\> Remove-OdbcDsn -Name "*Payroll*" -DsnType "User" -Platform "32-bit"
This command removes the 32-bit ODBC User DSNs that have names that contain Payroll.
Example 2: Remove the System DSN named MyPayroll from the native platform
PS C:\> Remove-OdbcDsn -Name "MyPayroll" -DsnType "System"
This command removes the ODBC System DSN named MyPayroll from the native platform.
Example 3: Remove all 32-bit ODBC System DSNs by using wildcard characters
PS C:\> Remove-OdbcDsn -Name "*Payroll*" -DsnType "System" -Platform "32-bit" -DriverName "SQL Server*"
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.
Example 4: Remove a 32-bit ODBC User DSN by using a name
PS C:\> $sysDsn = Remove-OdbcDsn -Name "MyPayroll" -DsnType "User" -Platform "32-bit" -PassThru
This command removes the 32-bit ODBC User DSNs named MyPayroll, and then stores the deleted DSN object in the $sysDsn variable.
Example 5: Remove a System DSN on the native platform by using the pipeline operator
PS C:\> Get-OdbcDsn -Name "MyPayroll" -DsnType "System" | Remove-OdbcDsn
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 op
erator. The example removes that DSN.
Example 6: Remove a ODBC System DSN on the native platform by using a variable
PS C:\> $dsnArray = Get-OdbcDsn -Name "MyPayroll" -DsnType "System"
PS C:\> Remove-OdbcDsn -InputObject $dsnArray
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.