5

I have MacBook Pro with OS X 10.6.7 and I have a Windows XP machine. I want to restart the Windows machine through the OS X command line. For example in Windows we can restart with this command:

shutdown -m \\IP -r -t 00

It will be restarted immediately.

How can I do this with a Mac?

1
  • 1
    So you are wanting to know how to SSH via a mac to a windows machine so you can type the command you described?
    – David
    Jun 20, 2011 at 19:11

3 Answers 3

6

If you have Samba tools installed, you can do

net rpc shutdown -r -I <IP> -U <username>
2
  • Where do I get Samba tools?
    – Tyilo
    Aug 21, 2011 at 2:41
  • 1
    Samba tools have been removed from the system in Lion, but you can install them via homebrew: brew install samba Note, though, that it can conflict with Apple's proprietary smbd, and re-enables parameters in smb.conf
    – Temikus
    Jul 27, 2013 at 16:44
4

You could just use the Windows RDP tool for Mac and RDP into your Windows XP machine and run the command,

shutdown -r -t 0

To restart the system without RDP then you can install an SSH Server (This forum thread could be of interest, but the link below includes the page to OpenSSH binaries for Windows anyway.) onto your Windows Machine and then simply accessing the Windows machine like:

ssh [email protected]

Will take you to the Windows command prompt, and I believe you could just run the Shutdown Command through SSH.

Here's a website I found, maybe you can make some sense out of it: http://www.tonyspencer.com/2005/12/03/restart-windows-remotely-through-vpn/

2
  • I know I can do it with RDP but is there another idea can connect to windows machine via bash?
    – Codey
    Jun 21, 2011 at 17:36
  • Changed my answer, hopefully it will help you further Jun 21, 2011 at 19:04
2

If your Windows box were running Windows Server, then you could RDP into a command-line only session and probably pipe the command shutdown -r -t 1 into the RDP session.

If your Windows box had an SSH server installed, then you could ssh in and do the same thing. I don't think there is another way--unless your Mac has a robotic arm attachment that could be controlled via the command-line to press the restart button on the XP box.

2
  • But I don't want to RDP can I do it from bash directly? or there is no solutions
    – Codey
    Jun 21, 2011 at 17:35
  • Well, there is something called "Services for Unix", or more recently, "Unix Subsystem" that Windows supports. It's a unix-like environment within Windows--but I think you'd still need an ssh server (or sim.) running to accept remote connections.
    – jpaugh
    Jun 24, 2011 at 22:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .