在当前的Powershell会话中,我正在运行以下命令
Import-Module SqlServer
Import-Module SQLPSSqlServer的导入模块命令工作正常,但SQLPS的导入模块命令失败
PS C:\windows\system32> Import-Module SqlServer
PS C:\windows\system32> Import-Module SQLPS
Import-Module : The following error occurred while loading the extended type data file: Error in TypeData
"Microsoft.SqlServer.Management.Smo.NamedSmoObject": The member DefaultKeyPropertySet is already present.
Error in TypeData "Microsoft.SqlServer.Management.Smo.NamedSmoObject": The member DefaultDisplayPropertySet is already
present.
Error in TypeData "Microsoft.SqlServer.Management.Smo.NamedSmoObject": The member DefaultDisplayProperty is already
present.
At line:1 char:1
+ Import-Module SQLPS
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand我尝试过使用Remove-Module命令删除SqlServer模块,但没有成功。我有一个脚本,它在开始时导入SqlServer模块,然后在脚本中有某些任务正在使用SQLPS模块(它失败了,出现了上面的错误)。我猜这两个模块不能在同一个powershell会话中加载。
发布于 2020-10-11 02:54:32
SQLPS是SQLServer模块的older version,您是对的;这两个模块是incompatible。然而,SQLServer模块旨在复制旧版本中的所有功能。
https://stackoverflow.com/questions/64107619
复制相似问题