I have a router installed pfSense, IP 192.168.254.3.
I wan to shutdown it from a windown pc. I code by C#. Here my code:
I tried change some others format of command text such as "poweroff". "admin@192.168.254.3 shutdown -p now", "ssh poweroff"
Please help me. Thanks
I wan to shutdown it from a windown pc. I code by C#. Here my code:
private void btnShutdown_Click(object sender, EventArgs e)
{
var sshcln = new Renci.SshNet.SshClient("192.168.254.3", 22, "admin", "pfsense");
if (sshcln.IsConnected == false)
{
sshcln.Connect();
Renci.SshNet.SshCommand cmd;
cmd = sshcln.CreateCommand("shutdown -p now"); //Shutdown command
cmd.Execute();
sshcln.Disconnect();
}
}
It was connected to 192.168.254.3. but nothing happened.I tried change some others format of command text such as "poweroff". "admin@192.168.254.3 shutdown -p now", "ssh poweroff"
Please help me. Thanks