Jump to content

Recommended Posts

Posted

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?

Posted

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)

Posted

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)

Posted (edited)

Why you are not using the switch /m \\computer to shutdown remote system?

Example: shutdown /m \\192.168.2.100 /s /f /t 0

Br,

UEZ

Edited 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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

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().
Posted

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!

Posted

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?

Posted (edited)

Why you are not using the switch /m \\computer to shutdown remote system?

Example: shutdown /m \\192.168.2.100 /s /f /t 0

Br,

UEZ

Im 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 by Jkeith247
Posted

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!!! :x

Posted

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.

Posted

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....

Posted (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 by Jkeith247
  • Moderators
Posted

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!

Posted (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 by Affe

[center][/center]

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...