A
A
An-Dem2015-09-04 10:44:35
PowerShell
An-Dem, 2015-09-04 10:44:35

C++ or PowerShell programs to poll Cisco sf300 over ssh or telnet?

Here is the code written in PowerShell, which most ciscos poll and write the result to a file, and sf300 hangs and ends the program only on the cisco timeout. She creates the file itself for writing, but she can’t write anything to it ((Maybe someone will figure it out, (I’m completely new to this and to be honest I don’t even know why this happens)
the code itself
New-SshSession -ComputerName 10.10.0.254 -ComputerName1 "" -Username KleriK -Password 123
$Results = Invoke-Sshcommand -InvokeOnAll -Command 'show clock'
\\Modules for ssh\\
$ErrorActionPreference ="Inquire"
Import-Module SSH-Sessions
\\filename to write to\\
$time = "$(get-date -f yyyy-MM-dd)"
$ext =".txt"
\\file path\\
$filepath ="C:\Users\Klerik\CiscoInfo\"
\\actual ip of the desired device\\
$d1 ="192.168.1.1"
\\login password\\
$u1 ="********"
$ p1 ="********"
\\and the polling command itself\\
$c1 ="show clock"
\\and this is actually the working code itself that does not work\\
New-SshSession $d1 - Username $u1 -Password "$p1"
$Results = Invoke-Sshcommand -InvokeOnAll -Command "$c1" | Out-File "$filepath$filename-$time$ext"
exit
if someone can, please write an analogue in c ++ well, or tell me in which direction to move. I roughly know that you need to use sockets, but I didn’t manage to google anything particularly suitable. Can anyone come across and know the OID for snmp in order to find out the time from the tsiska?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anatoly, 2015-09-04
@rbobot

At my last job I successfully used Rancid www.shrubbery.net/rancid

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question