VB.NET: Get which mode Windows booted up in - Normal, or Safe Mode
Aug 14, 2003 • Chris Pietschmann • Visual BasicThis code checks to see which mode Windows has booted up in. I found the information for this in the MSDN Library.
Requirements
- 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

Chris Pietschmann
DevOps & AI Architect | Microsoft MVP | HashiCorp Ambassador | MCT | Developer | Author
I am a DevOps & AI Architect, developer, trainer and author. I have nearly 25 years of experience in the Software Development industry that includes working as a Consultant and Trainer in a wide array of different industries.