В моей локальной сети у меня более 10 ПК . Мне нужно позаботиться обо всем ПК. Я хочу знать всю информацию об оборудовании ПК. Я также хочу управлять этим ПК, предположим, в этот момент я хочу перезапустить один из моих клиентских ПК. Возможно ли это в C # .Если есть какие-либо вопросы, пожалуйста, спросите. Спасибо заранее
Я использую приведенный ниже синтаксис для выполнения команды.
try
{
// create the ProcessStartInfo using "cmd" as the program to be run,
// and "/c " as the parameters.
// Incidentally, /c tells cmd that we want it to execute the command that follows,
// and then exit.
System.Diagnostics.ProcessStartInfo procStartInfo =
new System.Diagnostics.ProcessStartInfo("cmd", "/c " + "shutdown /r /m \\172.16.1.3 /t 1 /");
// The following commands are needed to redirect the standard output.
// This means that it will be redirected to the Process.StandardOutput StreamReader.
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
// Do not create the black window.
procStartInfo.CreateNoWindow = true;
// Now we create a process, assign its ProcessStartInfo and start it
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
// Get the output into a string
string result = proc.StandardOutput.ReadToEnd();
// Display the command output.
Console.WriteLine(result);
}
catch (Exception objException)
{
// Log the exception
}
Используя приведенный выше код, я получаю сообщение «Сетевой путь не найден».