Using PSEXEC does not return a remote task exit

I am using psexec to run exe on the server. The command works fine, but there is no way out on my local console.

This is the command I use:

psexec.exe \\my-machine ping localhost 

that leads to:

 PsExec v1.94 - Execute processes remotely Copyright (C) 2001-2008 Mark Russinovich Sysinternals - www.sysinternals.com ping exited with error code 0. 

if I try to run this locale, however, it works fine

 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. 
+6
psexec
source share
1 answer

It turns out that (at least in this case) you need to use the fully qualified name of the machine when starting psexec. I did not understand why this is so, but it is a trick.

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

and now the entire output of the command is returned.

+4
source share

All Articles