首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Powershell导入-模块SqlServer和SQLPS不能很好地相处

Powershell导入-模块SqlServer和SQLPS不能很好地相处
EN

Stack Overflow用户
提问于 2020-09-29 02:23:35
回答 1查看 431关注 0票数 0

在当前的Powershell会话中,我正在运行以下命令

代码语言:javascript
复制
Import-Module SqlServer
Import-Module SQLPS

SqlServer的导入模块命令工作正常,但SQLPS的导入模块命令失败

代码语言:javascript
复制
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会话中加载。

EN

回答 1

Stack Overflow用户

发布于 2020-10-11 02:54:32

SQLPS是SQLServer模块的older version,您是对的;这两个模块是incompatible。然而,SQLServer模块旨在复制旧版本中的所有功能。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64107619

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档