Sitemap

Amicuk Programming Answers

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

2015-10-11   Views:12

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
Help! I have a partner Java app using SSO with a custom login form. All is well in IE 6 but I get problems with Netscape 7. It authenticates to the Portal OK, but not to the partner app. The browser displays the following message: Oracle SSO Failure [More]
Being a new convert to Mac I was used to using right-click to access the "What's Here?" function in Google Maps on my old Windows PC. How do I use it on the Mac?Click on the Up Next icon (ringed in my screenshot): then on the Clear button: and H [More]
How can you use an iPhone 5 and display pictures or videos on the regualar tv I have a toshiba 47 inch flat screen tv with a ps3Airplay requires the use of an Apple tv, $99.00Read other 2 answers [More]
I have a problem getting my tv show dvds on my ipod, i can get regular movies to play, but not multiple shows, it picks one show and only loads it instead of the whole disk? can anyone help? I use the Videora converter and dvd decrypter.welcome to th [More]
Does Dreamweaver MX 2004 (or later versions) have the capability of pulling up a list of PHP functions you've created in code view --- where you could click on a function name and your cursor or focus would be automatically directed to the start of t [More]
Hi, I generated materialized view and will maintain data on it when I run delete statement that show below error ORA-01732: data manipulation operation not legal on this view So my question is How to maintain data on M View (delete old data)? because [More]
Hi all, I have a probleme with an InfoPath task form I've been looking for a solution to my problem for few days now with now success. I developped a visual studio  sequential workflow, i than designed an infopath Edit Task Form my form have followin [More]
Hi.I want to install the bw3.1 for oracle in windows 2003 .But in the process of the installation some error raised like this: Extract SAP System kernel archives INFO 2008-02-26 15:31:50 Creating file C:\SAPinst ORACLE KERNEL\SAPEXE.SAR.log. ERROR 20 [More]
Office location where Mac Pro is located has a slow internet connection.  I downloaded Mavericks installer onto thumbdrive.  Attempted to install on a dual 3 core Xenon Mac Pro, model 2,1.  After a few hours, I figured out that the error message that [More]
I have been able now to get iTunes to install, it seems to go through the whole process without any hitches. When the install finishes and says to start iTunes, I click the button and get an error message: "QuickTime was not found. QuickTime is requi [More]