Invoke-Command
在尝试使用或Enter-PSSession
目标运行 WMF 5.0(4 月预览版或 8 月预发布版)时,我遇到了一个奇怪的错误。
我无法在 Google 上找到任何对此的参考,所以我怀疑这是本地/网络配置问题,但我不确定如何追踪它。
有问题的帐户在两台机器上都具有本地管理员权限(在两台机器上都添加了域组),我可以在目标上本地运行任何和所有命令。相反方向的远程访问会导致相同的错误(也在运行 5.0.10514)。
--- 输出可识别信息的净化和调整格式以更好地包装---
# user@HOST | [2015-09-09 Wed 08:18]
C:\Windows>invoke-command -computer test {$psversiontable.psversion}
Major Minor Build Revision PSComputerName
----- ----- ----- -------- --------------
4 0 -1 -1 test
# user@HOST | [2015-09-09 Wed 08:18]
C:\Windows>enter-pssession -computer test
[test]: PS C:\Users\user\Documents> exit
# user@HOST | [2015-09-09 Wed 08:19]
C:\Windows>invoke-command -computer test {$psversiontable.psversion}
Major Minor Build Revision PSComputerName
----- ----- ----- -------- --------------
5 0 10514 6 test
# user@HOST | [2015-09-09 Wed 08:37]
C:\Windows>enter-pssession -computer test
enter-pssession : The term 'Measure-Object' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ enter-pssession -computer test
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Measure-Object:String) [Enter-PSSession],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
# user@HOST | [2015-09-09 Wed 08:38]
C:\Windows>