TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mohammed Ashraf
545
2.3k
506.4k
C# code to shut down remote pc in Lan network
Jan 18 2017 11:48 PM
Dear All.
I tried with following code to shut down remote pc in Lan network. But not working. Can anyone rectify the issue. The code is given belove.
public void Shutdown(string strComputerNameInLan)
{
string shutdownString = @"/c shutdown /s /t 1 -f -m \\" + strComputerNameInLan;
try
{
ProcessStartInfo psiOpt = new ProcessStartInfo("cmd.exe", shutdownString);
psiOpt.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.System);
psiOpt.WindowStyle = ProcessWindowStyle.Hidden;
psiOpt.RedirectStandardOutput = true;
psiOpt.UseShellExecute = false;
psiOpt.CreateNoWindow = true;
Process procCommand = Process.Start(psiOpt);
procCommand.WaitForExit();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button1_Click(object sender, EventArgs e)
{
Shutdown(textBox1.Text);
}
Reply
Answers (
1
)
How to append data to excel from text boxes ?
download link not work in webview