我正在安装dbatools以在Ubuntu容器上运行。
错误:
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我的文件
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
Import-Module dbatools要使我的powershell模块在不需要手动导入的情况下工作,需要做什么?
,谢谢!
发布于 2022-11-14 13:33:31
dbatools将此作为一个问题提出,并将在2.0上进行修正。
https://stackoverflow.com/questions/74405865
复制相似问题