I want to write a program that accesses my routers and perform some command, while its output is save to file on my disk. I have done this successfully using python pexpect
You may try the SSH.NET library.