2

I'm trying to use SSH.Net to add users Wifi mac address to Aruba Wifi controller, so I'm running these commands:

//connect to the remove server
SshClient sshclient = new SshClient(hostIP, userName, password);
sshclient.Connect();

//enter the "enable" command and press enter
SshCommand enable = sshclient.CreateCommand("enable");
enable.Execute();

//the "enable" command prompts for admin password, so enter the password and press enter
SshCommand pwd = sshclient.CreateCommand(enablePassword);
pwd.Execute();

//enter "cofigure t" command and press enter
SshCommand config = sshclient.CreateCommand("configure t");
config.Execute();

SshCommand aaa = sshclient.CreateCommand("aaa derivation-rules user ManagersDevices");
aaa.Execute();

SshCommand set = sshclient.CreateCommand("set role condition macaddr equals \"my mac address\" set-value guest description \"test\"");
set.Execute();

SshCommand save = sshclient.CreateCommand("write memory");
save.Execute();

But nothings happens and the user is not added...

Liran Friedman
  • 4,027
  • 13
  • 53
  • 96
  • I am pretty sure that _something_ happens, but probably not what you expect. Have you checked what each call to `Execute()` returns, instead of just executing the next command blindly? It might give a clue to what's wrong. – Micke Jun 17 '15 at 12:51
  • I've checked, and all results returned empty – Liran Friedman Jun 17 '15 at 13:03
  • 1
    Got my answer here: [How to run commands in cmd process?][1] [1]: http://stackoverflow.com/questions/30883237/how-to-run-commands-in-cmd-process/30886274?noredirect=1 – Liran Friedman Jun 17 '15 at 13:07

0 Answers0