Start, Stop, and Restart Windows Services from Mac OS X
Mac OS X includes Samba support by default, which allows for communication between OS X and Windows PC hardware. SMB is what enables simple Mac to Windows file sharing, but you can also go further and utilize the command line of OS X or Linux to remotely monitor, start, and stop services running on Windows machines – right from the terminal.
Do note that some Mac OS X versions will need to have Samba Tools installed separately to be able to run the ‘net rpc’ commands as instructed here. You can install samba with homebrew or MacPorts as needed.
This is really handy if you have a multi-OS environment network, and sysadmins should enjoy the ability remotely restart and monitor services running on a Windows machine without leaving OS X Terminal.
Listing Services Running on Windows PC from OS X Command Line
To list services running on the Windows machine, use this command:
net rpc service list -I IPADDRESS -U USERNAME%PASSWORD
A practical example would be targeting the Windows PC at 192.168.0.115 with login Windows and password MyPassword:
net rpc service list -I 192.168.0.115 -U Windows%myPassword
Stopping & Starting Windows Services from the Mac Using net rpc from the Command Line
After identifying the service you want to stop, start, or restart, you can issue the following command to stop the service:
net rpc service stop SERVICENAME -I IPADDRESS -U USERNAME%PASSWORD
Then you can restart (or start) the service by using the following command:
net rpc service start SERVICENAME -I IPADDRESS -U USERNAME%PASSWORD
This is tip that I found on Lifehacker that was aimed at Linux users, but considering Mac OS X has a unix underbelly equipped with samba the command works just the same on a Mac.