Environment.UserInteractive Property tells whether the current process is running in user interactive mode.
Imports System
Class Sample
Public Shared Sub Main()
Console.WriteLine("UserInteractive: {0}", Environment.UserInteractive)
End Sub 'Main
End Class 'Sample