Remotely Start Windows Service… from Samba

I was at university today when I realized I had disabled my WinVNC service over the weekend in order to isolate a problem that–as it turns out–was not related to VNC. Unfortunately, I had forgotten to restart the service and was left with no way to remote into my desktop at home. Worse, since I’ve been using Visual Studio a lot, I configured the bootloader to enter Windows by default rather than Gentoo–so no hope of fixing things remotely from there, either. As it turns out, however, the problem wasn’t nearly as difficult as I made it out to be.

Before I get into how I resolved the problem, it’s important to understand the network topography. First, on the periphery of my network at home is a Linux box which serves a number of duties, including gateway and file server. The gateway machine also has Samba installed. Behind that is a collection of other systems including my desktop workstation. The workstation was the machine with VNC disabled, and I don’t use Microsoft’s Remote Desktop. Thus, I had no way of access it, or so I thought.

After spending about an hour searching around the ‘net for methods of connection remotely to Windows, I had exhausted all possible solutions. Creating a tunnel was out of the question, as it is impossible to specify connection ports for commands like runas or the MMC. This meant that an ssh tunnel wouldn’t work; these commands would simply be processed by the local machine. No matter what I tried, it seemed as if it was impossible to start a Windows service remotely. Worse, the Samba man page states:

RAP SERVICE START NAME [arguments...]
Start the specified service on the remote server. Not implemented yet.

Note
Currently NOT implemented.

Great.

Turns out, the manpage is a bit dated as net works fine. In fact, after wasting so much time, I felt a bit foolish when I discovered the solution was much easier than I expected. Simply running:

net -S IP_ADDRESS -U USERNAME rpc service start WinVNC4

where IP_ADDRESS is the IP address of my desktop and USERNAME is the username I use to connect works. Samba even happily replied with:

Successfully started service: WinVNC4

Pessimistically, that’s an hour of my time I’ll never get back. What’s worse is that the Samba net command was the first place I looked until I was discouraged by the manpage. The manpage is a lie!

***

One Response to “Remotely Start Windows Service… from Samba”

  • Pedmont writes:

    Haha! Oh man… I’ve been in situations like that before where I know of a solution to a problem, yet am turned off by the (what will come to be) working solution from various sources. Its very irriatiting to me, but now that I look back its really quite funny.

Leave a comment

Valid tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>