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
Hi there, We are using Course Programs (EK) for many of our training programs.  We opted for either Course Programs or Curriculum Types but the beauty of Course Programs is it only shows learners (during follow-up) that have completed the required Co [More]
Dear Experts, Can anybody please explain, the step by step procedure for the Goods Receipt of Scheduling Agreement. I have created scheduling agreement (ME31L) and delivery schedule (ME38) with 15 schedule lines (e.g. from date 01.04.2008 to 15.04.20 [More]
I assembled a 100 page book using iLife'05 over the last week or so. Luckily I hadn't ordered the book before learning about the new "improved print quality" when using iLife'06. Well, iLife'06 finally arrived today and I installed it and... Wel [More]
Hi We have a plant "X" as no value warehouse Now I have a situation that I need to move some product to "X"  as no value (as we get free goods from one location "Y" and then when we ship the product from "X";  we wi [More]
Hi everybody, im trying to store an internal table <b>without</b> knowing the content - means the structure (fields)- into th DDIC, but i failed. The code is: DATA xslt_error TYPE REF TO cx_xslt_exception. TRY . perform load_file  using 'D:/us [More]
Hi! I want to display(open) an excel file from a java class but I have a problem. I am using the code as below: setContentType("application/vnd.ms-excel"); and it works. The problem is that i want to visualize datas from a query. One of this dat [More]
Check if XMLAnonymizer bean could be used on your sender adapter side and replace the SOAP namespaces with the ones defined in your SWCV. VJHi Rodney, I have few questions for you. Have you created message mapping according to ur target structure men [More]
Dear Experts, I trying to perform a copy in a script logic from some cost centers to another cost centers. To do this, the cost center dimension has a property DESTCC which indicates to which cost center must be copied. For instance, I have de follow [More]
Hi All, I am trying to call a dialog box from a script with this code: Dim MyDlg Set MyDlg = SudDlgCreate("Input", "DlgProgress") DIAdem displays the error >>Cannot find "dlgProgress.SUD" file<< How can I "te [More]
How do I 'restore' my AppleTV to it's original factory settings?the button with the minus symbol on it, yes the apple remote !http://www.geekology.co.za/blog/wp-content/uploads/2009/07/pair-unpair-apple-re mote-mac-appletv-1.jpg!Read other 5 answers [More]