2017-08-30 106 views
0

是否可以在Windows 7中運行get-odbcdsn? Windows 7中的Powershell似乎並不瞭解該cmdlet。Windows 7中的get-odbcdsn

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 

我試圖更新幫助,但它仍然沒有得到任何進一步的。 運行Get-odbcdsn導致此錯誤:

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. 

我已經更新了我的Windows PowerShell中7

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

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

如何運行在Windows 7中得到-odbcdsn?請幫忙。

如果get-odbcdsn無法在Windows 7中運行,是否有辦法解決該問題?我需要最終爲100個工作站創建odbc連接,其中大多數都有Windows 7。有沒有辦法通過PowerShell來做到這一點?

+3

你不這樣做,WDAC模塊(包括'Get-OdbcDsn' cmdlet)隨Windows 8一起發佈並且最多 –

回答

0

即使您更新了PowerShell版本,也不會獲得您認爲應包含的額外cmdlet。

原因是cmdlet需要OS級別的API才能正常工作,在這種情況下,MSFT_OdbcDsn WMI類首次引入Windows 8 and Server 2012,並且未包含在Windows 7及更早版本中。

+0

換句話說,在Windows 7中,我們不能使用powershell自動創建dsn條目爲機器,並必須通過運行odbcad32.exe手動執行它? – user1205746

+0

是的,這是正確的。 – Persistent13