VB.NET: Get which mode Windows booted up in - Normal, or Safe Mode

This code checks to see which mode Windows has booted up in. I found the information for this in the MSDN Library.


  • Namespace: System.Windows.Forms
  • Platforms: Win98, WinNT 4.0, WinME, Win2000, WinXP, and Windows .NET Server family
  • Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Select Case System.Windows.Forms.SystemInformation.BootMode
Case BootMode.FailSafe
    'The computer was started by using only the basic
    ' files and drivers.
    'This is the same as Safe Mode
Case BootMode.FailSafeWithNetwork
    'The computer was started by using the basic files,
    ' drivers, and services necessary to start networking.
Case BootMode.Normal
    'The computer was started in standard mode.
End Select