psexec install of copssh not working

3 posts / 0 new
Last post
somaddict
Offline
Last seen: 7 years 6 months ago
Joined: 09.06.2013 - 14:33
psexec install of copssh not working

Hello. I am able to install copssh fine locally, but I would like to push it to hundreds of servers at once with psexec. I run a command similar to this to test:

 

psexec \\10.215.8.253 -u administrator -p password -d  -c copssh.exe /S /D=C:\copssh

 

The file copies, and the process is created on the remote server, but it just seems to hang forever. If I try to run the installer with no arguments and the -i option for interactive, an error pops up on the server that says the installer encountered an error.

Have others had success withinstalling copssh.exe over psexec?

Thanks!

somaddict
Offline
Last seen: 7 years 6 months ago
Joined: 09.06.2013 - 14:33
I did some research and

I did some research and figured out this was a 64-bit issue, and that psexec is outdated.

psexec doesn't seem to work with the -w and -c flags to attempt to push the installer to a desinated directory. It always places the file in system32, which freaks out re: sysWOW64.

http://serverfault.com/questions/173464/psexec-hangs-error-launching-ins...

The solution in that thread does not work, but outlines the problem. I crafted a very ugly workaround based on what I saw here:

http://serverfault.com/questions/235990/work-around-to-use-psexec-on-win...

The idea is to mount a share, copy the file, unmount the share, install the package, cleanup. I put some cleanup at the beginning to deal with the testing I was doing, but this seems like a good idea because there will be errors if the share is still mounted or the service account already exists, and this will cause the '&&' to abort the command sequence. I thought about using & for a few of the commands but I think that is too risky as the next command may fire too soon if the previous one hangs a bit. I also noticed that if the service account remained during a reinstall that the sshd service seems to suffer an authentication failure because the service account password is not getting updated.

c:\tmp>psexec \\10.215.8.253 -u administrator -p password net user SvcCOPSSH /DELETE && net use X: /delete && net use X: \\10.215.8.253\C$ password /user:administrator && xcopy copssh.exe X: && net use X: /delete && psexec \\10.215.8.253 -u administrator -p password c:\copssh.exe /S /D=C:\copssh && psexec \\10.215.8.253 -u administrator -p password -i 0 -e -d -f -c clean.bat

This is in my cleanup script, which requires an additional line to cleanup the script itself. I <3 Windows!

#I prefer to remove references in the start menu
del C:\Users\Administrator.ZMAN\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Copssh
del C:\copssh.exe
del C:\windows\system32\clean.bat

somaddict
Offline
Last seen: 7 years 6 months ago
Joined: 09.06.2013 - 14:33
Forget

Forget psexec...

http://www.poweradmin.com/paexec/

paexec has these added features, as well as an encrypted password over the network:

Additional options only available in PAExec:

     -cnodel   If a file is copied to the server with -c, it is normally
               deleted (unless -d is specified).  -cnodel indicates the file
               should not be deleted.

     -clist    When using -c (copy), -clist allows you to specify a text
               file that contains a list of files to copy to the target.
               The text file should just list file names, and the files
               should be in the same folder as the text file.
               Example: -c -clist "C:\test path\filelist.txt"

               filelist.txt might contain:
               myapp.exe
               mydata.dat

               Myapp.exe and mydata.dat would need to be in C:\test path
               in the example above.

               IMPORTANT: The first file listed is assumed to be the one that
               will be executed.

               -clist and -csrc cannot be used together.

     -csrc     When using -c (copy), -csrc allows you to specify an
               alternate path to copy the program from.
               Example: -c -csrc "C:\test path\file.exe"

     -dbg      Output to DebugView (OutputDebugString)

     -dfr      Disable WOW64 File Redirection for the new process

     -lo       Log Output to file.  Ex: -lo C:\Temp\PAExec.log
               The file will be UTF-8 with a Byte Order Mark at the start.

     -rlo      Remote Log Output: Log from remote service to file (on remote
               server).
               Ex: -rlo C:\Temp\PAExec.log
               The file will be UTF-8 with a Byte Order Mark at the start.

     -to       Timeout in seconds.  The launched process must exit within this
               number of seconds or it will be terminated.  If it is terminated,
               the exit code will be -10
               This option is not compatible with -d
               Ex: -to 15
               Terminate the launched process after 15 seconds if it doesn't shut down first

     -noname   In order to robustly handle multiple simultaneous connections to a server,
               the source server's name is added to the remote service name and remote PAExec
               executable file.  If you do NOT want this behavior, use -noname