我是 PowerShell 的新手,我正在尝试一个执行 SQL 查询的简单脚本。它在我的 Windows 8 机器(PS 3.0)上运行良好,但在客户端机器(2008R2,PS 2.0)上运行良好 - 我在这条线上遇到了一个异常:
$credentials = New-Object System.Data.SqlClient.SqlCredential -argumentlist $user, $password
New-Object : Cannot find type [System.Data.SqlClient.SqlCredential]: make sure the assembly containing this type is loaded.
两台机器都安装了 .NET 2.0-4.0。
任何有关如何调试和修复此问题的建议将不胜感激。
另外,我怎么知道什么程序集文件/dll定义了给定的类型?例如,我如何找到包含的 DLL 的完整路径System.Data.SqlClient.SqlCredential
(我System.Data.SqlClient
在我的 Windows 8 机器上的 GAC 中看不到 a,但它在那里工作......)?
谢谢!