Strange PSExec Output on Windows Server 2012 and 2016
When running commands on multiple remote computers using PSExec, you might encounter strange output that ends with "See ends says "\Ser????C:\Windows\system32...". This article will explain the possible reasons and provide solutions for this issue.
Understanding PSExec
PSExec is a powerful tool developed by Microsoft that allows you to execute processes on remote Windows systems. It's part of the PsTools suite and is widely used for managing and automating tasks across multiple Windows machines.
The Strange Output
The strange output in question usually looks like this:
C:\Windows\system32>
See ends says "\Ser????C:\Windows\system32..."
This output is caused by a mismatch between the working directory of the local system and the remote system. When PSExec runs a command on a remote computer, it sets the working directory to the system32 folder of that remote computer. However, if the command you're running relies on the working directory of the local system, you might encounter the strange output mentioned above.
Solutions
To resolve this issue, you can use one of the following solutions:
-
Specify the full path of the command: Instead of running the command with just its name, provide the full path to the executable. This will ensure that the command is run from the correct location, regardless of the working directory.
-
Change the working directory on the remote system: You can use the
cdcommand to change the working directory on the remote system before running your command. For example:psexec \\computername -u username -p password cmd /c "cd C:\MyFolder & mycommand.exe"
-
Use the
-woption: The-woption allows you to specify the working directory for the remote system. For example:psexec \\computername -u username -p password -w C:\MyFolder mycommand.exe
The strange output you might encounter when running commands on multiple remote computers using PSExec is caused by a mismatch between the working directories of the local and remote systems. To resolve this issue, you can specify the full path of the command, change the working directory on the remote system, or use the -w option to specify the working directory for the remote system.