How to send a pipe with psexec?

Posted by Pierre-Alain Vigeant on Server Fault See other posts from Server Fault or by Pierre-Alain Vigeant
Published on 2011-07-04T21:17:58Z Indexed on 2012/10/03 21:42 UTC
Read the original article Hit count: 240

Filed under:
|

I'm trying to execute a pipe on a remote server by using psexec.

The command that I'm trying to execute is

psexec \\servername DSQUERY USER -name *userpart* | DSGET USER -samid -display

Currently, the | pipe symbol get executed locally which is not what is wanted (since dsget does not exist on my machine).

I tried to use quote around the whole command

psexec \\servername "DSQUERY USER -name *userpart* | DSGET USER -samid -display"

but that resulted in psexec trying to run that whole quoted sentence as one executable, which obviously does not exist.

How can I pass a pipe symbol to the remote server so that it can execute it?

© Server Fault or respective owner

Related posts about windows-server-2003

Related posts about psexec