Windows – Run Service Control (sc.exe) command on secure port

dmzportwindowswindows-service

Our team runs the following commands to turn on and off Windows Services (e.g. JBoss Native) from the Windows command line as well as through source code in a program. It connects to a remote box. We are now placing this box (\DEV-A1) into our DMZ. How can we still run this command remotely but use a secure port?

sc \\DEV-A1 stop JBAS50SVC
sc \\DEV-A1 start JBAS50SVC

Best Answer

sc.exe uses RPC to connect to remote hosts; RPC calls always start with a control connection to TCP port 135, but then another connection is opened using a random dynamic port to carry out the actual RPC call; the range of these dynamic ports can be limited, but how many of them are needed depends heavily on what the computer is doing.

Also, keep in mind that if the server is a domain member (which it probably is, since you are controlling it remotely with a command that uses integrated authentication), you will anyway need to open lots of ports in your firewall(s) in order for it to operate properly.

Related Topic