【问题标题】:powershell core error: The specified module 'RPC-Client' was not loadedpowershell核心错误:未加载指定的模块'RPC-Client'
【发布时间】:2021-02-27 04:40:41
【问题描述】:

如何为powershell 找到有关xml-rpc 的更多信息?

PS /home/nicholas> 
PS /home/nicholas> Update-Help                     
PS /home/nicholas> 
PS /home/nicholas> Get-Help Send-XmlRpcRequest     
Get-Help: Get-Help could not find Send-XmlRpcRequest in a help file in this session. To download updated help topics type: "Update-Help". To get help online, search for the help topic in the TechNet library at https://go.microsoft.com/fwlink/?LinkID=107116.       PS /home/nicholas>                                                                                                                  PS /home/nicholas> Get-Host | Select-Object Version                                                                                                                                                                                                                     Version                                                                                                                             -------                                                                                                                             
7.1.0

PS /home/nicholas> 
PS /home/nicholas> exit
nicholas@mordor:~$ 
nicholas@mordor:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal
nicholas@mordor:~$ 

当我运行Update-help 时,我希望能找到more 的信息。

也许添加一个module

我试过了:

nicholas@mordor:~/powershell$ 
nicholas@mordor:~/powershell$ pwsh hello.ps1 
Import-Module: /home/nicholas/powershell/hello.ps1:1
Line |
   1 |  import-module RPC-Client
     |  ~~~~~~~~~~~~~~~~~~~~~~~~
     | The specified module 'RPC-Client' was not loaded because no valid module file was found in any module directory.

hello
nicholas@mordor:~/powershell$ 
nicholas@mordor:~/powershell$ cat hello.ps1 
import-module RPC-Client 


"hello"
nicholas@mordor:~/powershell$ 

如何将其添加到 powershell 核心中?

我尝试安装为:

PS /home/nicholas/powershell> 
PS /home/nicholas/powershell> Find-Module -Name Xml

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
7.0                  Xml                                 PSGallery            A module providing converters for HTML to XML, vario…

PS /home/nicholas/powershell> 
PS /home/nicholas/powershell> Find-Module -Name Rpc
Find-Package: /snap/powershell/149/opt/powershell/Modules/PowerShellGet/PSModule.psm1:8879
Line |
8879 |          PackageManagement\Find-Package @PSBoundParameters | Microsoft …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | No match was found for the specified search criteria and module name 'Rpc'. Try Get-PSRepository to see all
     | available registered module repositories.

PS /home/nicholas/powershell> 
PS /home/nicholas/powershell> Find-Module -Name foo
Find-Package: /snap/powershell/149/opt/powershell/Modules/PowerShellGet/PSModule.psm1:8879
Line |
8879 |          PackageManagement\Find-Package @PSBoundParameters | Microsoft …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | No match was found for the specified search criteria and module name 'foo'. Try Get-PSRepository to see all
     | available registered module repositories.

PS /home/nicholas/powershell> Find-Module -Name Rpc-Client
Find-Package: /snap/powershell/149/opt/powershell/Modules/PowerShellGet/PSModule.psm1:8879
Line |
8879 |          PackageManagement\Find-Package @PSBoundParameters | Microsoft …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | No match was found for the specified search criteria and module name 'Rpc-Client'. Try Get-PSRepository to see all
     | available registered module repositories.

PS /home/nicholas/powershell> 

但也许需要先“下载”它?东西like:

sudo powershell -Command {Install-Module -Name AzureRM.Netcore}

或者至少沿着这些思路。

【问题讨论】:

    标签: xml linux powershell .net-core xml-rpc


    【解决方案1】:

    PowerShell 中没有内置 XML-RPC 功能。

    因此提供此类功能需要第三方代码。

    在您的情况下,您的脚本似乎需要 XmlRpc module,可从 PowerShell 库 here 获得(这意味着您可以使用 Install-Module XmlRpc 安装它)。

    但是,这个模块的最后一次更新是在 5 年多以前,早于 PowerShell 的跨平台版本PowerShell (Core),因此您必须自己确定它是否适用于 Ubuntu 等类 Unix 平台。

    【讨论】:

      【解决方案2】:

      来自 mklement0:

      PS /home/nicholas/powershell> 
      PS /home/nicholas/powershell> Install-Module XmlRpc
      
      Untrusted repository
      You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by 
      running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
      [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y
      PS /home/nicholas/powershell>         
      PS /home/nicholas/powershell> 
      PS /home/nicholas/powershell> Get-Help xmlrpc
                                                                                                                                      
      

      名称类别模块
      剧情简介----
      -------- ------ -------- ConvertTo-XmlRpcMethodCall 函数 XmlRpc

      ConvertTo-XmlRpcType 函数 XmlRpc

      Send-XmlRpcRequest 函数 XmlRpc

                                                                                                                                                                                         PS /home/nicholas/powershell> 
      

      看起来很有希望。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-06-02
        • 2019-02-25
        • 1970-01-01
        • 2016-03-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多