使用嵌套模块加载PowerShell模块会出现错误

时间:2018-09-07 10:21:28

标签: powershell powershell-module

我已经编写了一个自定义PowerShell模块。我的自定义模块使用SharePoint CMD let。所以在我的psd1文件中,我有一个嵌套的模块属性,例如:

NestedModules = @( 'Microsoft.SharePoint.PowerShell',
        '.\Modules\MyModule.psd1')

我是从PowerShell Modules and SnapIns

那里得到的

当我导入该模块时,我得到(错误数量的一小部分):

Import-Module : The following error occurred while loading the extended type data file: Error in TypeData
"Microsoft.Office.Server.Search.Administration.SearchServiceApplication": The member ServiceName is already present.
At line:1 char:1
+ Import-Module Test
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Import-Module], RuntimeException
    + FullyQualifiedErrorId : Module_ImportModuleError,Microsoft.PowerShell.Commands.ImportModuleCommand

Import-Module : The following error occurred while loading the extended type data file: Error in TypeData
"Microsoft.Office.Server.Search.Administration.SearchService": The member ProcessIdentity is already present.
At line:1 char:1
+ Import-Module Test
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Import-Module], RuntimeException
    + FullyQualifiedErrorId : Module_ImportModuleError,Microsoft.PowerShell.Commands.ImportModuleCommand

Import-Module : The following error occurred while loading the extended type data file: Error in TypeData
"Microsoft.Office.Server.Search.Administration.SearchService": The member ServiceName is already present.
At line:1 char:1
+ Import-Module Test
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Import-Module], RuntimeException
    + FullyQualifiedErrorId : Module_ImportModuleError,Microsoft.PowerShell.Commands.ImportModuleCommand

Import-Module : The following error occurred while loading the extended type data file: Error in TypeData
"Microsoft.Office.Server.Search.Administration.Keyword": The member ExpiryDate is already present.
At line:1 char:1
+ Import-Module Test
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Import-Module], RuntimeException
    + FullyQualifiedErrorId : Module_ImportModuleError,Microsoft.PowerShell.Commands.ImportModuleCommand

Import-Module : The following error occurred while loading the extended type data file: Error in TypeData

0 个答案:

没有答案