![](/img/trans.png)
[英]PowerShell 4 - Import-Module : The specified module 'SQLPS' was not loaded because no valid module file was found in any module directory
[英]Powershell Import-Module SqlServer and SQLPS dont get along
在當前的 Powershell 會話中,我正在運行以下命令
Import-Module SqlServer
Import-Module SQLPS
SqlServer 的導入模塊命令工作正常,但 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 會話中加載。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.