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?
rawandnetAsked:
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 192.168.1.1 -l sshuser -pw sshpassword -m "shutdown now -h"

DIM strServer
DIM strCommand
DIM strUser
DIM strPW
DIM WShell
DIM objExec

strServer = "192.168.1.1"
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

0
 
jvfernandezConnect With a Mentor Commented:
You can use winscp.com, 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:

http://winscp.net/eng/docs/scripting
0
 
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

http://etherealmind.com/putty-command-line/

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
0
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 192.168.1.1 -l sshuser -pw sshpassword), but command line (c:\plink.exe -ssh 192.168.1.1 -l sshuser -pw sshpassword -m "shutdown now -h") gives me error
plink: unable to open command file "shutdown now -h"
any idea why?
0
 
rawandnetAuthor Commented:
it is solved, thanks it should be with out -m
plink -ssh root@10.1.3.30 -pw Pass01 shutdown now -h
0
 
rawandnetAuthor Commented:
solved
thanks
0
All Courses

From novice to tech pro — start learning today.