11.16
I used AutoIT to create the following script to reset my Cisco 7940 IP Phones. It could be modified to script almost any telnet commands. It uses a file called “phones.txt” with a list of IP addresses (one on each line). Make sure you have that in the same directory.
Let me know if there is an interest in a compiled EXE version of this script that prompts for the password and I can put that together here.
The script follows:
$phonestxt = FileOpen("phones.txt",0)
$couldntreset = "I couldn't reset the following phones:"
$failedonce = 0
$endoffile = 0
While 1
$phonesIP = FileReadLine($phonestxt)
if @error = 1 Then
MsgBox(0,"Error!","Couldn't read phones.txt")
Exit
ElseIf @error = -1 Then
$endoffile = 1
EndIf
If $phonesIP <> "" then
TCPStartup()
Dim $IPtoTelnetTo = $phonesIP
Dim $port = "23"
Dim $ConnectedSocket = -1
$ConnectedSocket = TCPConnect($IPtoTelnetTo, $port)
If $ConnectedSocket = -1 Then
$failedonce = 1
$couldntreset = $couldntreset & " " & $phonesIP & ","
EndIf
Sleep('200')
TCPSend($ConnectedSocket, "PASSWORD" & @CRLF)
Sleep('200')
TCPSend($ConnectedSocket, "reset" & @CRLF)
TCPCloseSocket($ConnectedSocket)
TCPShutdown()
EndIf
If $endoffile = 1 Then
If $failedonce = 1 then
MsgBox(0,"Error!",$couldntreset)
Else
MsgBox(0,"Complete","All phones have been reset")
EndIf
Exit
EndIf
WEnd
No Comment.
Add Your Comment