shutdown linux remotly from windows

Is there any script that allow me to access linux from windows and shutdown the server?
I normally use putty to login to linux from windows.  But i don't know wheather putty allow user to run a script file from command prompt that says shutdown now -h?
Who is Participating?
sr75Connect With a Mentor Commented:
putty has a scriptable executable called plink.exe.  I use it to perform some maintenance on my SANs using vbscript.  But to use it just do this:

c:\plink.exe -ssh -l sshuser -pw sshpassword -m "shutdown now -h"

DIM strServer
DIM strCommand
DIM strUser
DIM WShell
DIM objExec

strServer = ""
strCommand = "shutdown now -h"

strUser = "sshUser"
strPW = "sshPassword"

set WShell = CreateObject("Wscript.Shell")
Set objExec = WShell.Exec("plink.exe -ssh " & strServer & " -l " _
			 & strUser & " -pw " & strPW & " -m " & strCommand)
strResult = objExec.StdOut.ReadAll

wscript.echo strResult

set strServer = Nothing
set strCommand = Nothing
set struser   = Nothing
set strPW     = Nothing
set WShell    = Nothing
set objExec   = Nothing

Open in new window

jvfernandezConnect With a Mentor Commented:
You can use, the command line version of winscp.exe to run scripts on a remote linux box, check this website to see if it fit your needs:
Monis MontherConnect With a Mentor System ArchitectCommented:
Yes you can do it with putty, create a shutlinux.bat no your windows and with one click you will shutdown the remote Linux server

Check this guide for command line usage

Also search on google putty command line

At the end if you fail let me know, I will help you create it but better learn things so you can do more stuff in the future
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

rawandnetAuthor Commented:
i can login to linux server using (c:\plink.exe -ssh -l sshuser -pw sshpassword), but command line (c:\plink.exe -ssh -l sshuser -pw sshpassword -m "shutdown now -h") gives me error
plink: unable to open command file "shutdown now -h"
any idea why?
rawandnetAuthor Commented:
it is solved, thanks it should be with out -m
plink -ssh root@ -pw Pass01 shutdown now -h
rawandnetAuthor Commented:
All Courses

From novice to tech pro — start learning today.