Hi folks,
I am trying to run a command in cmd to shutdown a remote pc on the hostname that I enter, but cannot seem to find a way to have the info where I need it. I can get the shutdown command to work without problem but only with predetermined commands. I've tried a number of different ways but still yet to make it work.
As you can see below I am trying to remote shutdown a computer that I enter in the text box but i cannot get the command to work as I want it :(
cheers in advance
I am trying to run a command in cmd to shutdown a remote pc on the hostname that I enter, but cannot seem to find a way to have the info where I need it. I can get the shutdown command to work without problem but only with predetermined commands. I've tried a number of different ways but still yet to make it work.
As you can see below I am trying to remote shutdown a computer that I enter in the text box but i cannot get the command to work as I want it :(
Code:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim hostname As String = (TextBox1.Text)
'Dim shut As New ProcessStartInfo("shutdown.exe", "-s -m" & hostname) 'With {.WindowStyle = ProcessWindowStyle.Hidden}
'Process.Start("shutdown -s -m \\" hostname)
'Shell("shutdown /m "hostname"")
End Sub
End Class