Set-OdbcDriver

Set-OdbcDriver

Configure driver's properties for one or more installed ODBC drivers. This configures driver's properties for one or more installed ODBC drivers.

Syntax

Parameter Set: InputObject
Set-OdbcDriver [-InputObject] <CimInstance> [-AsJob] [-CimSession <CimSession> ] [-PassThru] [-RemovePropertyValue <String> ] [-SetPropertyValue <String> ] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: Name
Set-OdbcDriver [-Name] <String> [-AsJob] [-CimSession <CimSession> ] [-PassThru] [-Platform <String> ] [-RemovePropertyValue <String> ] [-SetPropertyValue <String> ] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

Set-OdbcDriver configures the properties for one or more installed ODBC drivers. You can specify the properties to add or modify with the parameter SetPropertyValue, and specify the properties to remove with the parameter RemovePropertyValue.

You should use the driver installation program to install and uninstall a driver. You cannot install or uninstall a driver using PowerShell Cmdlets.

For more information about ODBC and drivers, see Microsoft Open Database Connectivity (ODBC) and Drivers.

Parameters

-InputObject<CimInstance>

Modifies the ODBC driver represented by the specified ODBC driver objects. Enter a variable that contains the objects, or type a command or expression that gets the objects.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Name<String>

Specifies one or more ODBC drivers by driver name. You can use wildcard characters.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

true

-Platform<String>

The platform architecture of the ODBC driver. Possible values are '32-bit', '64-bit' or 'All'. The default is '32-bit' on a 32-bit process and '64-bit' on a 64-bit process. This is the platform architecture on the remote machine if this command is executed in a remote CIM session.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-SetPropertyValue<String>

Specifies the property values of the ODBC driver to be modified or added. Format as an array of strings where each string is: <key>=<value>.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-RemovePropertyValue<String>

Specifies the property values of the ODBC driver to be deleted. This is an array of keys to be removed.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-PassThru

Passes the object created by this cmdlet through the pipeline. By default, this cmdlet does not pass any objects through the pipeline.

Returns an object representing the modified ODBC Driver. By default, this cmdlet does not generate any output.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-AsJob

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CimSession<CimSession>

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ThrottleLimit<Int32>

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

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

Examples

This command sets the key "CPTimeout" to the value 60 for the 32-bit driver named "SQL Server Native Client 10.0":

PS C:\> Set-OdbcDriver "SQL Server Native Client 10.0" -Platform 32-bit -SetPropertyValue "CPTimeout=60"

This command removes the property named "aaa" for all drivers with name started with "SQL Server" under the native platform:

PS C:\> Set-OdbcDriver "SQL Server*" -RemovePropertyValue "aaa"

This command removes the properties aaa1 and aaa2 and set the property aaa3 to bbb3 and aaa4 to bbb4 for driver named "SQL Server Native Client 10.0" under both 32-bit and 64-bit architectures:

PS C:\> Set-OdbcDriver -Name "SQL Server Native Client 10.0" -Platform All -RemovePropertyValue @("aaa1", "aaa2") -SetPropertyValue @("aaa3=bbb3", "aaa4=bbb4")

This command sets the key "aaa" to the value "bbb" for the 32-bit driver named "SQL Server Native Client 10.0" and stores the driver object into a PowerShell variable:

PS C:\> $driver = Set-OdbcDriver -Name "SQL Server Native Client 10.0" -Platform 32-bit -SetPropertyValue "aaa=bbb" -PassThru

This command removes the properties aaa1 and aaa2 and sets the property aaa3 to bbb3 and aaa4 to bbb4 for driver named "SQL Server Native Client 10.0" under both 32-bit and 64-bit architectures and uses the pipeline objects returned from the command Get-OdbcDriver:

PS C:\> Get-OdbcDriver "SQL Server Native Client 10.0" -Platform All
| Set-OdbcDriver -RemovePropertyValue @("aaa1", "aaa2") -SetPropertyValue @("aaa3=bbb3", "aaa4=bbb4")

This command removes the properties aaa1 and aaa2 and sets the property aaa3 to bbb3 and aaa4 to bbb4 for driver named "SQL Server Native Client 10.0" under both 32-bit and 64-bit architectures and uses the PowerShell variable $driverArray:

PS C:\> $driverArray = Get-OdbcDriver "SQL Server Native Client 10.0" -Platform All
Set-OdbcDriver -InputObject $driverArray -RemovePropertyValue @("aaa1", "aaa2") -SetPropertyValue @("aaa3=bbb3", "aaa4=bbb4")

Get-OdbcDriver

N:Wdac