使用PSEXEC不会返回远程任务的输出

问题描述:

我正在使用psexec在服务器上运行exe。 该命令运行正常,但在本地控制台上没有输出。使用PSEXEC不会返回远程任务的输出

这是我使用的命令:这将导致

psexec.exe \\my-machine ping localhost 

PsExec v1.94 - Execute processes remotely 
Copyright (C) 2001-2008 Mark Russinovich 
Sysinternals - www.sysinternals.com 

ping exited with error code 0. 

,如果我尝试运行然而,这localy,它工作正常

psexec.exe \\localhost ping localhost 

PsExec v1.94 - Execute processes remotely 
Copyright (C) 2001-2008 Mark Russinovich 
Sysinternals - www.sysinternals.com 



Pinging my-machine.mydomain.com [1.1.1.1] with 32 bytes of data: 

Reply from 1.1.1.1: bytes=32 time=2ms TTL=128 
Reply from 1.1.1.1: bytes=32 time<1ms TTL=128 
Reply from 1.1.1.1: bytes=32 time<1ms TTL=128 
Reply from 1.1.1.1: bytes=32 time<1ms TTL=128 

Ping statistics for 1.1.1.1: 
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), 
Approximate round trip times in milli-seconds: 
    Minimum = 0ms, Maximum = 2ms, Average = 0ms 
ping exited on localhost with error code 0. 

它事实证明(至少在这种情况下),您需要在启动psexec时使用完全限定的机器名称。 我还没有想出为什么这是,但它伎俩。

psexec.exe \\my-machine.mydomain.com ping localhost 

现在所有命令的输出都被返回。

+1

它不适合我。我尝试了fqn和没有。是否有任何其他工具不同于psexec.exe – Maverick 2013-01-10 18:46:17