Executing Win32 commands in RSH – revisited


In my last post; the execution of Win32 commands through RSH was considered. Although the method discussed works seamlessly, it can be very cumbersome if you already have a script that used to work in *NIX environment and now porting that to the Windows environment.

The *NIX style commands are available in different location of Windows – SUA installation and replacing each and every command can be time consuming. Needless to say this process also introduces chances of errors.

A simpler approach will be to have a common location where we put all the necessary commands and then notify our script though some mechanism to look for that location for any executable.

Fortunately, Windows RSH uses one registry key to map the location of executable. Windows rshd uses ‘_CS_PATH’ registry key under ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SUA’, to set path in executing shell on remote machine. This registry key can be modified to include any path, so we don’t have to provide full path while running the binary through rsh.

Skip to main content