Enter-PSSession与configurationName:找不到错误'System.Object []'

时间:2019-11-17 05:18:47

标签: powershell

我正在尝试测试端点服务器,但是在此步骤中出现错误:

PS C:\>  Enter-PSSession –ComputerName localhost -ConfigurationName JEATest -Credential clc\administrator
Enter-PSSession : Processing data from remote server localhost failed with 
the following error message: Requested value 'System.Object[]' was not found. 
For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:2
+  Enter-PSSession –ComputerName localhost -ConfigurationName JEATest - ...
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (localhost:String) [Enter PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed

我已经创建了configurationFile JEAtest.pssc和角色功能文件:

这是JEATest.pssc文件

@{

# Version number of the schema used for this document
SchemaVersion = '2.0.0.0'

# ID used to uniquely identify this document
GUID = '7f46843c-faaf-4a84-a3a3-b859b9bcbaed'

# Author of this document
Author = 'Administrator'

# Description of the functionality provided by these settings
# Description = ''

# Session type defaults to apply for this session configuration. Can be 
#'RestrictedRemoteServer' (recommended), 'Empty', or 'Default'
SessionType = 'RestrictedRemoteServer'

# Directory to place session transcripts for this session configuration
TranscriptDirectory = 'C:\ProgramData\JEAConfiguration\Transcripts'

# Whether to run this session configuration as the machine's (virtual) 
administrator account
RunAsVirtualAccount = $true

RoleDefinitions = @{
    'clc.com\JEA_NonAdmin_Operator' = @{ 'RoleCapabilities' = 'JEATest'
} }
}

这是JEATest.psrc文件

@{

# ID used to uniquely identify this document
GUID = 'fc245bc2-0c27-4382-a37d-39092011a845'

# Author of this document
Author = 'Clc Admin'

# Company associated with this document
CompanyName = 'CLC'

# Copyright statement for this document
Copyright = '(c) 2016 CLC Admin. All rights reserved.'

SessionType = 'RestrictedRemoteServer'

# Cmdlets to make visible when applied to a session
VisibleCmdlets = 'Restart-Computer',
      @{ Name = 'Restart-Service';
      Parameters = @{ Name = 'Name';
      ValidateSet ='DNS' }},
      'Get-*'

# External commands (scripts and applications) to make visible when applied to a session
VisibleExternalCommands = 'C:\Windows\system32\ipconfig.exe'
}

我真的不知道'System.Object []'在这里。 我正在VMware Powershell v5.1上使用Windows Server 2016。我已经在Google上搜索,但没有解决方案。感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

搜索大约一天后,我就知道了。我的问题太疯狂了!!! =。=

JEATest.psrc和JEATest.pssc中的变量SessionType = 'RestrictedRemoteServer'是重复的。所以我只是在文件pssc中删除了该变量,尝试再次成功连接端点。我希望这会有所帮助。