Hi,
I want make a Console Application in VB.NET which will logoff all (but not an Administrator) users connectend to Windows 2003 Server machine via RDP Connection.
I wrote an application which is restarting Server machine, but when there're logged in users, Server got suspended.
Code of my current application:
Can you help me? :joyous:
I want make a Console Application in VB.NET which will logoff all (but not an Administrator) users connectend to Windows 2003 Server machine via RDP Connection.
I wrote an application which is restarting Server machine, but when there're logged in users, Server got suspended.
Code of my current application:
VB.NET:
Imports System.IO
Module Module1
Sub Main()
Dim Data As Date = Now 'get actual date and time
Dim sciezkaPlik As String = "C:\TAI\RestartPC\restartLOG.txt" 'file path
Dim zapiszDoPliku As New System.IO.StreamWriter(sciezkaPlik, True) 'create a log file
zapiszDoPliku.WriteLine("Komputer zostanie wyłączony za 60s - " & Data) 'write a message to log file
zapiszDoPliku.Close() ' close log file
System.Diagnostics.Process.Start("shutdown", "/r /f /t 60 /d up:0:0") 'force restart Server machine
'/r -restart, /f - force close applications, /t 60 - wait 60s,
'/d up:0:0 - write to system log message: 'other tasks (scheduled)'
End Sub
End Module
Can you help me? :joyous: