Monday, 17 October 2016

Shutdown/Restart Mac from Windows - Command Line

Administrators may occasionally be required to perform maintenance on Mac devices/servers from a windows based operating system. The following utility and command can be used to remotely shutdown/restart/reboot a mac/linux device from the command line on a windows based system - eg. Windows 7, 8, 10, Server 2003, 2008, 2012 etc.

First of all, create a .txt file (in this case it will be placed in C:\ but it can be placed anywhere), and put the following line inside the text file. This is the actual shutdown command that will be sent to the Mac/Linux device

sudo shutdown -r now

Next we need to download the application plink.exe. Plink.exe is a free utility that can be download absolutely free from the website below;

Place the plink.exe file into a folder on the windows device, and then run the following command from a command line. Note that this command references the command.txt we created above, so adjust the path accordingly if you didn't place it in C:\ as per this example

plink.exe -ssh -t mac-ipaddress -l root -pw macrootpw -m c:\command.txt

mac-ipaddress = the IP address or hostname of the Mac/Linux device to be shutdown
macrootpw = the password for the "root" user account of the Mac/Linux device to be shutdown

If you do not have the "root" user account enabled, or do not know the password it can be enabled and reset by following the instructions in the following link;

1 comment:

  1. BlueHost is ultimately one of the best hosting provider for any hosting services you require.