【问题标题】:Powershell 5 output on Nano serverNano 服务器上的 Powershell 5 输出
【发布时间】:2015-11-23 07:06:28
【问题描述】:

如果我在 Windows 10 上的 powershell 4 中运行此命令:

powershell $ENV:ProgramFiles

我明白了:

C:\Program Files\

太棒了!

如果我在 Windows Nano Server 上使用 powershell 5 做同样的事情,我会得到如下信息:http://paste.openstack.org/show/479695/

"\n******************** START Argument Information ********************\r\nArgs'
 Count: 1\r\n     #0: $ENV:ProgramFiles\r\n******************** END   Argument I
nformation ********************\n\r\n\n.................... START Result  Output
 ....................\r\nResults Count: 1\r\n     #0: C:\\Program Files\r\n.....
............... END   Result  Output ....................\n\r\n\n...............
..... START Error   Output ....................\r\nErrors Count: 0\r\n..........
.......... END   Error   Output ....................\n\r\n\n....................
 START Warning Output ....................\r\nWarnings Count: 0\r\n.............
....... END   Warning Output ....................\n\r\n\n.................... ST
ART Information Output ....................\r\nInformation Count: 0\r\n.........
........... END   Information Output ....................\n\r\n\n...............
..... START Verbose Output ....................\r\nVerbose Count: 0\r\n.........
........... END   Verbose Output ....................\n\r\n"

我能做些什么来获得命令的标准输出?

【问题讨论】:

  • 我正在安装Windows Server 2016,我也想玩!等待我的 RPi2 也测试 W10 IoT。我会在运行 nano 后尽快提供帮助。

标签: windows powershell powershell-5.0 nano-server


【解决方案1】:

您需要运行新的 PowerShell 进程吗?如果您直接运行命令(在 PSSession 中),它会按预期工作(nan01 是我的 vanilla Nano 服务器):

ps:\> Enter-PSSession nan01 -Credential (Get-Credential)
[nan01]: PS C:\Users\Administrator\Documents> $env:ProgramFiles
C:\Program Files

根据您的示例创建新流程时,我会得到与您类似的长字符串输出。我的猜测是它代表了生成的 Powershell 进程的状态,在它终止之前发出。

顺便说一句,它也是 Windows 10 上的 PowerShell 5。

【讨论】:

  • 是的,我需要一个新进程,因为我使用 pywinrm 通过 winrm 运行。
猜你喜欢
  • 1970-01-01
  • 2018-09-13
  • 2012-10-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-11-18
  • 1970-01-01
相关资源
最近更新 更多