Chris Pietschmann

husband, father, hacker, entrepreneur, futurist, innovator, autodidact


.NET Framework - Check if Windows booted in Normal or Safe Mode

Heres a really small code sample on how to check which mode Windows was booted up in (Normal or Safe Mode). This works in .NET 1.x and 2.0.

  1 'This code checks to see which mode Windows has booted up in.
  2 Select Case System.Windows.Forms.SystemInformation.BootMode
  3 Case BootMode.FailSafe
  4      'The computer was booted using only the basic files and drivers.
  5      'This is the same as Safe Mode
  6 Case BootMode.FailSafeWithNetwork
  7      'The computer was booted using the basic files, drivers, and services necessary to start networking.
  8      'This is the same as Safe Mode with Networking
  9 Case BootMode.Normal
10      'The computer was booted in Normal mode.
11 End Select


blog comments powered by Disqus