我正在安裝 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 所需的設定。
測驗5.ps1
Import-Module dbatools
我需要做什么才能使我的 powershell 模塊作業而無需手動匯入?
謝謝!
uj5u.com熱心網友回復:
dbatools 將此作為問題提出并在 2.0 上修復。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/533441.html
上一篇:execve如何運行命令?
下一篇:單擊按鈕將元素移動到不同位置
