Sitemap

Amicuk Programming Answers

Automatically create ODBC DSN connection with special port and password. Add-OdbcDsn cmdlet

2015-10-11   Views:11

Advertisement

Hi, I first posted a question in the SQL forum but I'm posting it here instead because its a Powershell question. In a non-persitent VDI enviroment we are trying to automatically create a ODBC DSN connection to a SQL server. We are using Windows 8.1

Hi,
I first posted a question in the SQL forum but I'm posting it here instead because its a Powershell question.
In a non-persitent VDI enviroment we are trying to automatically create a ODBC DSN connection to a SQL server.
We are using Windows 8.1 so we also have Powershell 4 together with the add-odbcdsn cmdlet. 
But when trying to add set -SetPropertyValue for network port different than default and a password we get an error.
here is the command:
Add-OdbcDsn -Name test -DriverName "SQL Server" -DsnType User -SetPropertyValue @("PWD=test", "SERVER=10.0.0.1")
and here is the error message:
Add-OdbcDsn : Attempt to set the {UID or PWD} key of a DSN. These keys should not be stored in the registry for securit
y reason. Provide the credential information at runtime via SQLDriverConnect, SQLConnect or SQLBrowseConnect.
At line:1 char:1
+ Add-OdbcDsn -Name test -DriverName "SQL Server" -DsnType User -SetPropertyValue @ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (MSFT_OdbcDsnTask:Root/Microsoft/...SFT_OdbcDsnTask) [Add-OdbcDsn], Cim
Exception
+ FullyQualifiedErrorId : MI RESULT 4,Add-OdbcDsn
NB!:  this command does not contain a port number, but when adding it without a password(PWD string) we just the default port.

The replay answer
Advertisement
Hi Primeid,
Agree with Jrv, we cannot store  UID and PWD in an ODBC datasource, For example, you can create a DSN using the user interface but if you look at the DSN stored in the registry the UID and PWD are not stored.
ODBC it is always required when you connect using a DSN that the caller supply UID and PWD if they want to use standard login during connection time. 
These similar discussion are for your reference:
Creating ODBC DSN for SQL Native
Client fails for not-integrated authentication
is user name and password required in ODBC admin / User DSN?
In addition, to read data from a SQL Server database using an ODBC DSN with SQL Authentication via powershell, please refer to this script:
Open SQL database with ODBC DSN and SQL AuthenticationIf
there is anything else regarding this issue, please feel free to post back.
If you have any feedback on our support, please click here.
Best Regards,
Anna Wang
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Go to See the other 4 answers

Automatically create ODBC DSN connection with special port and password. Add-OdbcDsn cmdlet

Category:DefaultRelease time:2015-10-11Views:130

Hi, I first posted a question in the SQL forum but I'm posting it here instead because its a Powershell question. In a non-persitent VDI enviroment we are trying to automatically create a ODBC DSN connection to a SQL server. We are using Windows 8.1[More]

Automatically create ODBC DSN connection with powershell or GPO

Category:DefaultRelease time:-0001-11-30Views:130

Hi, I'm trying to create a ODBC connection that has a special network port and also password automatically stored. I have tried to do this with the add-odbcdsn cmdlet and adding attributes to a group policy object configuration without luck. If I try[More]

How to create odbc (dsn) connection for OBIEE AND INFOR in unix environment

Category:DefaultRelease time:-0001-11-30Views:130

Hi, we are establishing OBIA in Unix environment we set all the things fine but we are getting problem how to create ODBC connection for INFORMATICA AND OBIEE. I searched some blogs thats telling there is a ODBC.INI file we need to configure. but i a[More]

Issue with creating oracle ODBC DSN connection

Category:DefaultRelease time:-0001-11-30Views:130

Hi all, We have BO X! 3.1. We have created some webi reports. Our universe connection is created using following method. = Created a DSN connection for oracle 10g database = created Bo connection object by selecting Generic ODBC connection = in the s[More]

Creating ODBC DSN for SQL Server in LINUX

Category:DefaultRelease time:-0001-11-30Views:130

Hi All, I am getting probelms in creating DSN for SQL server. I have created an entry in odbc.ini file under ODBC sources and provided the SQL server detiails as follows [ODBC Data Sources] AnalyticsWeb=Oracle BI Server Cluster=Oracle BI Server SSL_S[More]

ODBC DSN Connection

Category:DefaultRelease time:-0001-11-30Views:130

Hi All,    I have a report that needs to connect to a local( to the server) DSN Connection on the Crystal Server 2008 and am having difficulty viewing the report. I am getting connection errors. My question is: How do I configure the report under "Da[More]

Creating ODBC socket connection to Excel

Category:DefaultRelease time:-0001-11-30Views:130

Hello, helpful people! I installed CF8 without documentation. This caused the known issue of not doing a full install of ODBC drivers. I was actually doing fine (I could, for some reason, use MySQL drivers without an issue) until I suddenly wanted an[More]

Problem in creating ODBC new DSN in Informatica

Category:DefaultRelease time:2015-10-11Views:130

I Installed 1. Oracle 11g R2 64 bit 2. Informatica 9.1.0 64 bit Successfully. but when I tried import tables from Oracle, I got an error in creating ODBC DSN [ERROR NO:193]. But when I create through ODBC Aministration Tool through control panel, the[More]

DSN connection across different environments

Category:DefaultRelease time:-0001-11-30Views:130

Hie Guys, A database has 3 different servers for DEV, TEST & PROD. Now, while creating a DSN for the Universe, do you have to create a DSN for each environment (Dev, Test & Prod) ? How does this work? Could anyone please help me understand the con[More]

DB2 Connection VIA ODBC DSN

Category:DefaultRelease time:-0001-11-30Views:130

Can anyone point me to good 'step-by-step' guide to setting up a HS connection to an AS400 DB2 database using a ODBC connection. I have an ODBC DSN on set up but I'm not sure how set-up my tsnnames.ora or listener.ora, I've looked at several posts in[More]

How to create a DSN-less connection to SQL Server for linked tables in Access

Category:DefaultRelease time:-0001-11-30Views:130

hey i cant understand how i use that Function if that information what you need  stLocalTableName: dbo_user_name stRemoteTableName: user_name stServer :sedo2015.mssql.somee.com stDatabase :sedo2015 stUsername :sedo_menf_SQLLogin_1 stPassword :1234567[More]

Hot
I use the track pad and just updated to Lion - which has some great features. But I while I can two finger swipe on Safari pages to go back and forth, I don't seem to be able to do that now when going through my files in Finder.... Am I missing somet [More]
Hello I am need of some quick assistance. The external HDD the was holding my iTunes library has died. THe hard drive is completely dead. Well its clicking when trying to be read and cannot be repaired through disk utility. I have a backup of my libr [More]
I have a problem with Autofs in OSX 10.8 I have an afp file share set up on a ubuntu server I map this share to a mac mini using finder menu "connect to sever" This includes user and password and this works fine. mac-mini:Volumes$ ls Home Direct [More]
I have been using Firefox as my browser, but haven't had a toolbar. I tried to use Verizon's toolbar, but that keeps throwing me back to Internet explorer 9, which I don't want to use, and asks me to use I.E 9 as my default browser. All I want is to [More]
hi friends....plz tell me any table name holding the value of  material document(migo) and purchase order.Hello, The table for this EKBERead other 3 answers [More]
I have tried three times to download and install the iPod software update 2.2.1 and have been unsuccessful. Each time the software downloads and the download appears complete (the circle with the arrows disappears, the horizontal bar marches up to 27 [More]
Hi, I need to take backup of my script before making any changes  ..how to download the script ?? RegardsHi raghu, Standard program : RSTXSCRP Regards, SravanthiRead other 5 answers [More]
Hello everybody I would like to know if it is possible to display waveform graphs vertically on front panel and if enventually could someone tell me how to do it. Thanks vey much for help.You'll have to use an XY graph, and do some programming. You c [More]
Hi, We are in the process of implementation. I prepare employee group EG as Permanent,Fixed, trainees etc.... and under permanent  we have all salaried employees.  query :- All salaried employees in Unit 1 and Unit3  are divided in to two diff catego [More]
Guys, Do we need to install any software to use odi email utility? Can I test odi email utility in my personal laptop which contain odi 11g with 11g database can I test without any other software?like sending email to my hotmail a/c? Can you give me [More]