I'm creating an application at work that uses SNMPWalk to get details on specific IP addresses. Right now it's meant to use Nmap to find all printers in a specified network and then it uses SNMPWalk to get details on each printer.
The problem is that SNMPWalk is giving me the error:
"No log handling enabled - using stderr logging
-v2c: (Sub-id not found: (top) -> -v2c)"
My code is here:
Process p = new Process();
p.StartInfo.FileName = snmploc + "\\snmpwalk.exe";
p.StartInfo.ErrorDialog = false;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = false;
p.StartInfo.WorkingDirectory = snmploc;
p.StartInfo.Arguments = "–mALL -v2c –cpublic " + printer.IP();
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.Start();
Console.WriteLine("Snmpwalk has been fired");
Console.WriteLine("Waiting for Snmp to terminate...");
string output = p.StandardOutput.ReadToEnd();
string error = p.StandardError.ReadToEnd();
p.WaitForExit();
Console.WriteLine(p.ExitCode);
printer
is an object of the class Printer
. It is used to contain printer details such as ip address, name, model, serial number, and open ports. snmploc
is obtained from command line arguments.
The main reason that this is so complicated is that when I try using the exact same command in a command prompt it works perfectly.