首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在Linux容器中加载dbatools

无法在Linux容器中加载dbatools
EN

Stack Overflow用户
提问于 2022-11-11 17:01:13
回答 1查看 27关注 0票数 0

我正在安装dbatools以在Ubuntu容器上运行。

错误:

代码语言:javascript
复制
 Could not import /usr/local/share/powershell/Modules/dbatools/1.1.142/bin/smo/coreclr/System.Security.SecureString.dll : Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'System.Security.SecureString, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'."
 At /usr/local/share/powershell/Modules/dbatools/1.1.142/internal/scripts/libraryimport.ps1:150 char:21
 +                     [Reflection.Assembly]::LoadFrom($assemblyPath)
 +                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
 + FullyQualifiedErrorId : FileLoadException
  
 Import-Module : The specified module '/usr/local/share/powershell/Modules/dbatools/1.1.142/bin/dbatools.dll' was not loaded because no valid module file was found in any module directory.
 At /Test5.ps1:12 char:1
 + Import-Module dbatools
 + ~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo          : ResourceUnavailable: (/usr/local/share/po\u202642/bin/dbatools.dll:String) [Import-Module], FileNotFoundException
 + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

我的文件

代码语言:javascript
复制
From myImage

RUN pwsh -Command 'Set-PSRepository -Name PSGallery -InstallationPolicy Trusted'

RUN pwsh -command "Install-Module sqlserver -Scope AllUsers -Force"
RUN pwsh -command "Install-Module dbatools -Scope AllUsers -Force"
RUN pwsh -command "Get-module -ListAvailable -Name 'dbatools'"
RUN pwsh -command "Get-module -ListAvailable -Name 'sqlserver'"

COPY Test5.ps1 .

CMD [ "pwsh", "Test5.ps1"]

myImage包含在ubuntu 20上运行powershell的请求设置。

Test5.ps1

代码语言:javascript
复制
Import-Module dbatools

要使我的powershell模块在不需要手动导入的情况下工作,需要做什么?

,谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-11-14 13:33:31

dbatools将此作为一个问题提出,并将在2.0上进行修正。

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

https://stackoverflow.com/questions/74405865

复制
相关文章

相似问题

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