try this -
somehost% nexec -i -l windowshost cmd /c "echo quit|telnet somehost 8080"
thank you for your reply.
the /c in cmd option is " Carries out the command specified by string and then terminates"
for my use the command is terminate immediately and i don't know the outcome of it.
I need to know if the port is open or not.
Are you sure that the target server has telnet installed? Since 2008 Server, telnet is not installed by default and so it might be that this is the problem.
thank you for your reply Telnet Client is enabled on the win target.
Can you confirm that the host you are executing the nexec has telnet installed? I have been playing around with this and have noted that because NSH is not able to find telnet on my host it's getting the same error.
I am still playing around a bit with it and will get back to you with additional information when I have a chance.
thank you for your replay,
i am very sure i also found the telnet command on the target C:\Windows\System32\telnet.exe
i also tried to run it like this nexec -i -l windowshost /c/Windows/System32/telnet.exe somehost 8080
but it returns like nothing happened.
I will play around with this a bit more and see what we can do.
nexec on windows can be funny. also - even from the commandline on windows the errorlevel isn't correct - eg:
echo quit | telnet nohost 10
-> 0, even when nohost doesn't exist.
any other options to check if port open/close from remote host ?
i am testing for "netstat -an | grep 8080" on the target host but then if there is FW filter i will not know since telnet is not working.
any suggestion are welcome
If anyone interesting I download the NMAP tool for windows and i and i am using the NSH to execute the nmap from command line and this is working great.
Is NMAP allowed in your environment? because nmap will not allowed by maximum customer.