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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jvfernandezCommented:
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 MontherSystem 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
sr75Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.