user1205746
user1205746

Reputation: 3364

get-odbcdsn in Windows 7

Is it possible to run get-odbcdsn in Windows 7? Powershell in windows 7 does not seem to understand the cmdlet.

PS C:\Windows\system32> get-help "odbc"
get-help : Get-Help could not find odbc in a help file in this session. To download updated help topics type: 
"Update-Help". To get help online, search for the help topic in the TechNet library at 
http://go.microsoft.com/fwlink/?LinkID=107116.
At line:1 char:1
+ get-help "odbc"
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

I have tried to update-help but it is still not getting any further. Running Get-odbcdsn caused this error:

Get-OdbcDsn : The term 'Get-OdbcDsn' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

I have updated my powershell in windows 7

PS C:\Windows\system32> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      0      10586  117 

How do I run get-odbcdsn in windows 7? Please help.

If get-odbcdsn could not be run in windows 7, is there a way to get around the issue? I need to eventually create odbc connection for 100 workstations, most of them have windows 7 on it. Is there a way to do that through powershell?

Upvotes: 3

Views: 3543

Answers (2)

Ieuan
Ieuan

Reputation: 148

As pointed out, the 'Get-ODBCDSN' cmdlet requires Windows 8/Server 2012 or higher.

In lieu of this, you could use the "Configure a Data Source Item" in Active Directory Group Policy to achieve this.

Or failing that, you could add the required registry keys directly under HKLM\SOFTWARE\ODBC\ODBC.INI.

Upvotes: 2

Persistent13
Persistent13

Reputation: 1562

Even if you have updated your version of PowerShell you do not get the addition cmdlets that you would assume would be included.

The reason for that is cmdlet require OS level APIs to be present for them to function, in this case the MSFT_OdbcDsn WMI class that was first introduced in Windows 8 and Server 2012, and are not included in Windows 7 and earlier.

Upvotes: 0

Related Questions