PSexec Output Code

Does anyone know how to disable the "copyright" header when it appears when PSExec starts up? Everutime I run the command "./psexec ...". I see this message:

PsExec v2.11 - Execute processes remotely
Copyright (C) 2001-2014 Mark Russinovich
Sysinternals - www.sysinternals.com

This is really annoying and it inflates the output of my script.

Thanks
Matthew

+4
source share
4 answers

There seems to be no way to disconnect it from what is happening, but as a workaround, you can redirect STDERR, which will suppress the output,

psexec \\remotemachine command 2>nul
+8
source

Or better you can do

set F1=find /v "PsExec v2.11 - Execute processes remotely"
set F2=find /v "Copyright (C) 2001-2014 Mark Russinovich"
set F3=find /v "Sysinternals - www.sysinternals.com"
set FILTER=%F1%^|%F2%^|%F3%

psexec \\remotemachine command 2>&1 | %FILTER%
+3
source

, , PowerShell PowerShell, :

%SystemRoot% WinRM.
PowerShell :
$ret = & PsExec.exe \\RemoteMachine powershell.exe -Command '$env:SYSTEMROOT'

Object[] . :

PS> $ret
(0)
(1) PsExec v2.2 - Execute processes remotely
(2) Copyright (C) 2001-2016 Mark Russinovich
(3) Sysinternals - www.sysinternals.com
(4)
(5) C:\WINDOWS

, 6- .

PowerShell , , .

, :
$ret = $ret[5..($ret.Count - 1)]

.

, PowerShell, .

+2

PsExec v2.2 -nobanner.

0

All Articles