Telnet Automation using PowerShell


i want script telnet unix box. should run telnet 172.16.x.x. should given login prompt, user name "user, , password "password". that’s script should , ideally report logged in or not. have sample script written correctly?

 

[sourcecode language="vbscript"]

set oshell = createobject("wscript.shell")

oshell.run("telnet")

wscript.sleep 1000

oshell.sendkeys("open 172.16.x.x 23")

wscript.sleep 1000

oshell.sendkeys("{enter}")

wscript.sleep 1000

oshell.sendkeys("user")

wscript.sleep 1000

oshell.sendkeys("{enter}")

wscript.sleep 1000

oshell.sendkeys"password"

wscript.sleep 1000

oshell.sendkeys("{enter}")

wscript.sleep 1000

 [/sourcecode]

this powershell forum, not handle vbscript here.

if need vbscript help, can post on in scripting guys forum:

https://social.technet.microsoft.com/forums/scriptcenter/en-us/home?forum=itcg

also, you'll find sendkeys extremely unreliable , won't think will. that's they'll tell if post script on there.


don't retire technet! - (don't give yet - 13,225+ strong , growing)



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

CRL Revocation always failed

Failed to query the results of bpa xpath

0x300000d errors in Microsoft Remote Desktop client