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 have a computer ruinning windows 7 64, I have Icloud 2.0 innstalled, and I have an Iphone 3gs and an Ipad 3 with sim all hooked up to the same apple id. I have set up Icloud on all devices. Photos taken with iphone or ipad syncs perfectly to all un [More]
Dear All when we make the customer goods return receipt with movement type 651 this movemet type is not creating any Accounting Document  on the document status when we click on the accounting button its giving the message material dose not inculding [More]
I have had great problems importing and scaling images for Keynote presentations with approx 500+ images. Having tried to adjust the image to fit the full screen the scaling results in unacceptable pixelation. I seem to have solved this now by batch [More]
Dear All, How to create a Service Contract ? (ABAP related devlopment) The Info I have is that Service contract will contain: u2022     Validity Start u2022     Validity End u2022     Duration u2013 minimum period for contracts Additional Info: 1. Cr [More]
pourquoi un diaporama en lecture automatique ne redémarre pas après un arrêt manuel (transition de diapositive manuelle) ?Thanks for your answer, Best regards, Pierre Richard Preti De : Sanjit_Das <[email protected]<mailto:[email protected]>> [More]
Hi, When I opened iTunes today I get the message: "iTunes was not properly installed. If you want iTunes to be able to retrieve CD infromation from the internet, you need to reinstall iTunes." This is the first time it has happened, and doesn't [More]
Whenever I try to download anything off of the interent, my computer says that it cannot create a file.I'm having a similar issue as well. For some reason, anytime I try to download any type of file, an error box with this pops up. "DapPlugin is unab [More]
My mac mini is set up with two sata disks installed, one is a 128 ssd and the other a 1tb hdd.  Since installing mountain lion, the hdd keeps ejecting itself, and i get a message saying - this hard disk was not properly ejected. then i wont find the [More]
<Unable to reinstall X-FI Fatality Platinum Champion series.. ok seeing as i got no response at all in my other post here>>>> http://forums.creative.com/t5/Windows-7/X-Fi-Platinum-Fatality-Champion-Series-Win-7-x64-Error-I-000/td-p/547599?a [More]
Why is mozilla going the way of apple? There is no reason to take options away from users. I should not have to wait for my add-on that disables version checking to be updated to the new version because it fails version checking. Stop treating me (an [More]