Jkeith247 Posted January 16, 2011 Posted January 16, 2011 So, I am pretty new to Auto It. From what I understand though, AutoIT has the capability to open a socket and send telnet commands. What I am looking to do is login to a machine via telnet, send login and password, give the pc the command to shutdown /s and close the connection. I think the whole process would be much more stable doing this without having auto it open a command line window. Is this possible with autoit?
Jkeith247 Posted January 16, 2011 Author Posted January 16, 2011 So, from my reading, this is what I have put together, seems like it should work, but it doesn't... Can someone tell me what I am doing wrong? Thank you! TCPStartup() $Socket = TCPConnect("192.168.2.100", 23) Sleep (1000) TCPSend($Socket, "Username"&@CRLF) Sleep (1000) TCPSend($Socket, "Password"&@CRLF) Sleep (2000) TCPSend($Socket, "shutdown /s"&@CRLF)
Jkeith247 Posted January 16, 2011 Author Posted January 16, 2011 So, from my reading, this is what I have put together, seems like it should work, but it doesn't... Can someone tell me what I am doing wrong? Thank you! TCPStartup() $Socket = TCPConnect("192.168.2.100", 23) Sleep (1000) TCPSend($Socket, "Username"&@CRLF) Sleep (1000) TCPSend($Socket, "Password"&@CRLF) Sleep (2000) TCPSend($Socket, "shutdown /s"&@CRLF)
UEZ Posted January 16, 2011 Posted January 16, 2011 (edited) Why you are not using the switch /m \\computer to shutdown remote system?Example: shutdown /m \\192.168.2.100 /s /f /t 0Br,UEZ Edited January 16, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Developers Jos Posted January 16, 2011 Developers Posted January 16, 2011 (edited) Can't test myself but are you sure you want to send CRLF or just LF ? Edited January 16, 2011 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
smartee Posted January 16, 2011 Posted January 16, 2011 So, from my reading, this is what I have put together, seems like it should work, but it doesn't...Can someone tell me what I am doing wrong?Thank you!TCPStartup()$Socket = TCPConnect("192.168.2.100", 23)Sleep (1000)TCPSend($Socket, "Username"&@CRLF)Sleep (1000)TCPSend($Socket, "Password"&@CRLF)Sleep (2000)TCPSend($Socket, "shutdown /s"&@CRLF)I am guessing the computer you are sending those delightful little packets to is not listening. Look at TCPAccept(),TCPListen().
Jkeith247 Posted January 16, 2011 Author Posted January 16, 2011 I am guessing the computer you are sending those delightful little packets to is not listening. Look at TCPAccept(),TCPListen().The Telnet Server is windows 7 home premium. I have tested the connection by manually telneting into it and shuting it down via "shutdown /s", so I know the server is listening. Its just a matter of getting autoit to send the commands. I am gonna try using @LF now, but I believe I have tried that already.Thank you all!
Jkeith247 Posted January 16, 2011 Author Posted January 16, 2011 So i tried it with LF only and it didnt work. :-(
ravaged1 Posted January 16, 2011 Posted January 16, 2011 The Telnet Server is windows 7 home premium. I have tested the connection by manually telneting into it and shuting it down via "shutdown /s", so I know the server is listening. Its just a matter of getting autoit to send the commands. I am gonna try using @LF now, but I believe I have tried that already.Thank you all!Like UEZ said why telnet in to shut it down?
Jkeith247 Posted January 16, 2011 Author Posted January 16, 2011 (edited) Why you are not using the switch /m \\computer to shutdown remote system?Example: shutdown /m \\192.168.2.100 /s /f /t 0Br,UEZIm sorry, excuse my noobism... I was looking at this, but could not figure out how to use it. I tried it looking for some documentation on it but couldn't find any. Edited January 16, 2011 by Jkeith247
somdcomputerguy Posted January 16, 2011 Posted January 16, 2011 Maybe this'll help in the future - http://www.google.com/search?q=shutdown+command. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
Jkeith247 Posted January 17, 2011 Author Posted January 17, 2011 sorry to keep beating a dead horse.... but the situation at hand is, I have multiple machines that I need to shutdown on a scheduled nightly basis. I have been looking at the shutdown \\name command and i have a couple issues with it. I cant have any visible window and I have other devices that are not pc's that need the same telnet script to work. In light of the issues that I am having, I think I need a little more AUTOIT education. Does someone have a link to a more comprehensive guide to autoit language? Thanks! Also, does anyone have any other ideas why my simple script doesnt work? Thanks again!!!
NoobieAutoitUser Posted January 17, 2011 Posted January 17, 2011 I use this program to "telnet" to my ISP's mail server, and delete my email. Its called "Telnet Scripting Tool a.k.a TST10.exe". As the title says, you can script with it. I hope this is what you were looking for. Good luck. http://jerrymannel.com/blog/2008/11/11/telnet-scripting-tool-aka-tst10exe/ http://blog.cleannet.co.th/?p=165 From what I gather is it is freeware. Though I could be wrong.
Jkeith247 Posted January 19, 2011 Author Posted January 19, 2011 What I really need for to make this program work the way I intend it to is for autoit to telnet in to these machines in the background (without being seen is key) so they can be shutdown. The people that will be using this are not the most technologically inclined people and another window will just create more problems down the road. Is it even possible for autoit to telnet into windows? I saw mention on another post that autoit could not natively telnet into windows....
JoHanatCent Posted January 19, 2011 Posted January 19, 2011 (without being seen is key)....Wonder why though if this is scheduled nightly! Have you looked at the shutdown parameteres /m /p /f
spykelight Posted January 19, 2011 Posted January 19, 2011 As far as I know, the telnet protocol is more complex then just opening a socket on port 23.
Jkeith247 Posted January 21, 2011 Author Posted January 21, 2011 (edited) Well, I dont want this to open other windows, because it opens up the oportunity for other people to mess things up. It is being used in an environment where people are technologically illiterate and the random opening of windows would freak them out. Is there even a way to open a telnet connection to a windows machine and send commands? I have looked at the shutdown parameters and it has its own set of issues. If I had telnet it would open the door to give me other controls and abilities that would definitely be helpful in the future for using peripheral devices that respond to telnet. This is key. If someone has some insight as to where I could do some homework on autoit/telnet connections working in tandem I will be forever grateful. Thanks! Edited January 21, 2011 by Jkeith247
Moderators JLogan3o13 Posted January 21, 2011 Moderators Posted January 21, 2011 Just have to ask - your users are "technologically illiterate" as you put it, to the point that "opening of windows would freak them out", yet you think an abrupt reboot of the machine will NOT "freak them out"? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Jkeith247 Posted January 21, 2011 Author Posted January 21, 2011 No, they are meant to be shut down at a scheduled time.
Affe Posted January 21, 2011 Posted January 21, 2011 (edited) Could you not write an autoit program to run at startup on the machine to be shut down and simply shut down at a scheduled time? Does the time the PC have to shut down change each night? If it's the autoit icon in the corner that bothers you, you can hide it... Opt("TrayIconHide", 1) ;0=show, 1=hide tray icon ;insert code here using Date.au3 to monitor the time, then... Shutdown(15) ;Force a shutdown and power down Edited January 21, 2011 by Affe [center][/center]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now