摘要:I有几个函数放置在为隐式远程处理而构建的远程windows服务器上。但是,我无法利用Get-Help cmdlet来显示我在创建的每个函数中的概要,所以这些是而不是本机powershell cmdlet。get-help cmdlet在本地运行的脚本运行良好。
问题:不可能在隐式远程处理中使用Get-帮助吗?
编辑1。
试图修复英国人
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发布于 2017-02-15 16:41:54
隐式远程处理是一种奇怪的野兽。它在临时模块中创建代理函数,并在本地调用代理函数。
调用Import-PSSession之后,调用Get-Module,您将看到一个名为tmp的奇怪名称。
或者,您可以首先使用此方法$module = Import-Module -PSSession $mySession -PassThru导入模块,以获得变量中返回的模块。
然后您可以调用Get-Command -Module $module来查看函数,但请查看定义:
Get-Command -Module $module | Select-Object -First 1 -ExpandProperty DefinitionShay Levy在这里详细介绍了代理函数。,您可以看到它们确实包含了对Get-Help的说明,这样它就可以找到正确的帮助主题,但是当命令位于远程处理的另一端时,我不认为它们会起作用。
我不知道我是否曾经尝试过用帮助的方式导入函数,所以也许它确实有效,这只是你发现的一个bug,但是我觉得这个信息还是有帮助的。
https://stackoverflow.com/questions/42254847
复制相似问题