Hi everybody,

i am trying to get IPs from a switch with vbs through telnet. i am recording that IPs to excel sheet. the problem is when i try to read that IP data vbs copy or paste it as a string. so telnet can not recognize string as a ip adress. please help me about this problem

Hi everybody,

i am trying to get IPs from a switch with vbs through telnet. i am recording that IPs to excel sheet. the problem is when i try to read that IP data vbs copy or paste it as a string. so telnet can not recognize string as a ip adress. please help me about this problem

You need to convert the data back to the data type that telnet requires.
"2" is a string value
CInt("2") is an integer value

Telnet raises an error because it cannot use a string value in that situation.

You need to convert the data back to the data type that telnet requires.
"2" is a string value
CInt("2") is an integer value

Telnet raises an error because it cannot use a string value in that situation.

i already try that but this function useless for me because i am dealing with ip adresses such as (172.28.253.254) when i apply CInt function to IPs i get integer value of quad dot IP adress.(ex: 172.28.253.254 -> 2887581182 )

Need more information to help you out. Exactly what are you trying to do?
How would you do this directly using a telnet prompt?

Give an example of what you need to do. Without the information, It's really like trying to shoot in the dark.

Buy you might try using a shell command.

dim lngReturn as long
lngReturn = shell("telnet.exe 155.23.23.24 other parameters etc, 3")

You should get a return value of the program's (telnet) task ID. Or 0 if the shell
command did not work. The shell expects a string so the string type should not be a
problem. Spaces mark the different parameters telnet expects. The 3 value just signifies a
value for the type of window you want telnet to take. Check the shell command in your
documentation.

Ok let me explain my code. the script connects a swicth than send a code to list its neibours. so the switch send to the screen lots of data such as neibours host name and IPs then script captures all the data and split into the IPs and host name. After capturing the data script send it to the excel file. by now the script work flawless. but when the script try to connect IPs which recorded to te excel file telnet do not let this happen

but when the script try to connect IPs which recorded to te excel file telnet do not let this happen

This is the part of the code which is causing the problem, apparently. However, I cannot read your mind. Nor do I have the ability to divine what was written in your script at this part.

You need to provide information that we can use to work with. Provide the part of the script you're using that doesn't work. Otherwise, we're still just shooting in the dark.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.