How do I run multiple commands from SSH.Net?

I am trying to use SSH.Net to add the MAC address of Wifi users to the Aruba Wifi controller, so I am running the following 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 nothing happens and no user is added ...

+3
c # ssh ssh.net


source to share


No one has answered this question yet

See similar questions:

6
How do I execute commands on an SSH server in C #?
3
Renci SSH.NET: How to create symbolic links?

or similar:

3575
How to list a transfer?
2058
How do I get a consistent byte representation of strings in C # without manually specifying the encoding?
1877
What is a NullReferenceException and how do I fix it?
1758
How do I generate a random int?
1743
What's the best way to give a C # auto property an initial value?
1742
How to calculate a person's age in C #?
1147
How do I use SSH to run a shell script on a remote machine?
934
How do I specify a private SSH key to use when executing a shell command on Git?
490
Run command line commands
-2
Run multiple commands / Set server password



All Articles
Loading...
X
Show
Funny
Dev
Pics