Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

VS 2012 Running Shutdown

$
0
0
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 :(

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

cheers in advance

Viewing all articles
Browse latest Browse all 27514

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>