The Catalyst team asked me to evaluate and install an SSH/SFTP/SCP service for them on all of the CATXXX Windows servers. After some evaluation and testing, we settled on bitvise WinSSHD. To “save time” I decided to try scripting the install.
Here is the process that I came up with:
for /f %%s in (catserv.txt) do copy /v /y c:installWinSSHD-Inst.exe \%%sc$installWinSSHD-Inst.exe
for /f %%s in (catserv.txt) do copy /v /y c:installcat_config.wst \%%sc$installcat_config.wst
c:localbinpsexec.exe @catserv.txt "c:installWinSSHD-Inst.exe" -site=WinSSHD -acceptEULA -activationCode=[insertCodeHere] -settings=c:installcat_config.wst
for /f %%s in (catserv.txt) do sc \%%s start winsshd
for /f %%s in (catserv.txt) do sc \%%s query winsshd | find /i "running" >> isrunning.txt
Note that this script required a few files to be in place before execution:
- Sysinternals “psexec.exe” must be in place in “c:localbin”.
- The WinSSHD installer must be located in “c:install”
- A WinSSHD server configuraiton file named “cat_config.wat” must be in place in “c:install”
- This script and the catserv.txt file must be present in “c:localscripts”. The catserv.txt file contains a simple list of the servers to which WinSSHD will be installed.