Get-Help cmdlet无法与隐式远程抗管



摘要:我有几个功能放置在构建用于隐式远程的远程Windows服务器上。但是,我无法利用Get-Help cmdlet来显示我在我创建的每个功能中放置的概述,因此它们是本机PowerShell cmdlets。Get-Help cmdlet可以在本地运行的脚本运行良好。

问题:是否不可能使用隐式远程使用Get-Help?

编辑1。

尝试Briantists修复

PS> $module = Import-Module 'tmp_2c0mhyix.ivb' -PSSession $sessVar -PassThru
Import-Module : Failure from remote command: Import-Module -Name 'tmp_2c0mhyix.ivb': The specified module 'tmp_2c0mhyix.ivb' was not loaded because no valid module file was found in any module directory.
At line:1 char:11
+ $module = Import-Module 'tmp_2c0mhyix.ivb' -PSSession $sessVar-Pa ...
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (tmp_2c0mhyix.ivb:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

也使用模块名称也尝试了一下。

PS> $module = Import-Module -PSSession $sessVar-PassThru
Import-Module : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:11
+ $module = Import-Module -PSSession $sessVar-PassThru
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Import-Module], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.ImportModuleCommand

隐式远程是一种奇怪的野兽。它在临时模块中创建代理函数,并且是代理函数在本地被称为。

致电Import-PSSession后,请致电Get-Module,您会看到一个带有怪异TMP名称的人。

另外,您可以最初使用此方法$module = Import-Module -PSSession $mySession -PassThru导入模块以使模块返回变量。

然后,您可以致电Get-Command -Module $module查看功能,但请查看定义:

Get-Command -Module $module | Select-Object -First 1 -ExpandProperty Definition

Shay Levy在此处详细介绍了有关代理功能的详细信息,您可以看到它们确实包含了Get-Help的说明,以便它可以找到正确的帮助主题,但是当命令在远程远程方面,我不知道认为这些会起作用。

我不知道我是否曾经尝试过这种导入的函数的帮助,所以也许它确实有效,这只是您发现的一个错误,但是我觉得此信息仍然有用。<<<。/p>

最新更新