linux - 输入-PSSession 返回 PSInvalidOperationException

标签 linux powershell ubuntu core

我正在尝试使用:

Enter-PSSession -ComputerName 10.10.10.5 -Credential administrator

这给了我:

Enter-PSSession : MI_RESULT_ACCESS_DENIED
At line:1 char:1
+ Enter-PSSession -ComputerName 10.10.10.5 -Credential administrator ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (10.10.10.5:String) [Enter-PSSession], PSInvalidOperationException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

Ansible 同时工作没有问题:

Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/setup.ps1
<10.10.10.5> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 10.10.10.5
<10.10.10.5> WINRM CONNECT: transport=ssl endpoint=https://10.10.10:5986/wsman
<10.10.10.5> WINRM OPEN SHELL: 5001549B-C9A9-41FF-B9A3-8D19155EE123
EXEC (via pipeline wrapper)
<10.10.10.5> WINRM EXEC 'PowerShell' ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Unrestricted', '-']
<10.10.10.5> WINRM RESULT u'<Response code 1, out "{"changed":false,"an", err "\r\n">'
<10.10.10.5> WINRM CLOSE SHELL: 5001549B-C9A9-41FF-B9A3-8D19155EE123

有什么方法可以调试吗?

最佳答案

-ComputerName 正在寻找一个字符串。

Enter-PSSession -ComputerName '10.10.10.5' -Credential administrator

'10.10.10.5' 现在将具有 System.String 的 TypeName

谢谢,蒂姆。

关于linux - 输入-PSSession 返回 PSInvalidOperationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46706618/

相关文章:

linux - 有适用于 Linux 的 JavaCard 3.0.4 SDK 吗?

c++ - 使用 g++ 编译多个源目录

powershell - 在 PowerShell 中格式化数字以删除大于 1k 的数字 ","?

powershell convertfrom-json 选择对象差异

python - 属性错误 : 'module' object has no attribute

c - SPI 完成回调处理程序

c++ - gdbserver 跟随 child

azure - 如何将 Azure 中的 Azure RM 资源与其 EA 门户中的计费信息结合起来?

php - JSON_NUMERIC_CHECK 根本行不通

string - 找到二进制字符串时删除文件中的字节