LightningWar
LightningWar

Reputation: 975

Set-OdbcDsn - Determine Property Values

I'm trying to configure properties of an existing ODBC DSN. Working example code:

$properties = @('server=myserver1', 'description=sql server 2008')
Set-OdbcDsn -Name 'TestDSN' -SetPropertyValue $properties -DsnType System

This works, server and description are valid input. My question is: how can I discover a list of properties -SetPropertyValue accepts? If I use:

Set-OdbcDsn -Name 'TestDSN' -SetPropertyValue = @('foobar=myserver2') -DsnType System

This does not work, for obvious reasons. It returns the error Set-OdbcDsn : Invalid keyword-value pairs

I checked this powershell reference, but no help.

How can I find valid keyword names for -SetPropertyValue?

Upvotes: 1

Views: 3929

Answers (2)

Tax Max
Tax Max

Reputation: 103

For your "TestDSN" you can see valid keywords in property "Attribute". In this case it's "Description, Server, Regional, Database".

Get-OdbcDsn -Name TestDSN


Name       : TestDSN
DsnType    : System
Platform   : 32-bit
DriverName : SQL Server
Attribute  : {Description, Server, Regional, Database}

Upvotes: 0

Shawn Esterman
Shawn Esterman

Reputation: 2342

A quick google search led me here. It contains the two values you found to work, server & description AND it did not contain the value foobar which did not work.

Upvotes: 2

Related Questions