代码之家  ›  专栏  ›  技术社区  ›  Derek Ekins

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

  •  6
  • Derek Ekins  · 技术社区  · 17 年前

    这是我正在使用的命令:

    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.
    

    但是,如果我尝试在本地运行此程序,它可以正常工作

    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.
    
    2 回复  |  直到 17 年前
        1
  •  4
  •   Derek Ekins    17 年前

    事实证明(至少在本例中)在启动psexec时需要使用完全限定的机器名。 我还不明白为什么会这样,但它确实起了作用。

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

        2
  •  0
  •   Uwe Keim    8 年前

    对于你的问题,我已经给出了三种变体 check this URL .

    这将复制远程系统中的iname.bat文件并执行它,并将结果保存在运行PSexec的本地机器目录中的success.txt中

    PsExec.exe\remote_ip-u Administrator-ptest@123-c-f“iname.bat”>success.txt

    PsExec.exe\remote_ip-u Administrator-ptest@123-i cmd/C“C:\abhi\test.bat>C:\abhi\success.txt”

    这将在远程计算机上运行test.bat present,并在本地计算机上生成Success.txt

    PsExec.exe\remote_ip-u Administrator-ptest@123cmd/C“C:\abhi\test.bat”>success.txt

    PsExec.exe\remote_ip-u Administrator-ptest@123-c-f“在南蝙蝠”