Jump to content

boot type


Recommended Posts

does anyone know if it is possible to tell

- if the system is in safe mode?

-if the server is in active directory restore mode

So I can

If $mode = ..... Then

I'd compare running services. I don't know at the moment what normally running services are stopped in Safe Mode, but in preparation you could boot to Safe mode, AD Restore mode and normally and run sc query at a command prompt in each to list the running services and their running states. SC.EXE comes included with Win XP and Server 2003; you probably have to download it with the Windows 2000 Resource Kit for Win 2K systems.

Having that and the AutoIt3 beta, you could test a service for running status with:

; Dim variables used
Dim $ourProcess, $ourService, $output
; Init the service name we wish to test
$ourService = "Themes"

; Run the SC query and capture the output from STDOUT
$ourProcess = Run("sc query " & $ourService, @SystemDir, @SW_HIDE, 2)
; Loop and read from STDOUT until there's no more output
While 1
    $output &= StdoutRead($ourProcess)
    If @error = -1 Then ExitLoop
WEnd

; Test for the string RUNNING in the output
If StringInStr($output, "RUNNING") Then
    MsgBox(0, "Debug", "Service " & $ourService & " is running.")
Else
    MsgBox(0, "Debug", "Service " & $ourService & " is not running.")
EndIf

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

  • Moderators

You could check the SAFEBOOT_OPTION environment variable. Not sure if this will work for AD Restore Mode.

$mode = EnvGet( "SAFEBOOT_OPTION" )
If $mode == "" Then MsgBox(0, "Safemode Status", "Your computer is not in safemode.")
If $mode == "Minimal" Then MsgBox(0, "Safemode Status", "Your computer is in normal safemode.")
If $mode == "Network" Then MsgBox(0, "Safemode Status", "Your computer is in safemode with networking.")
If $mode == "DsRepair" Then MsgBox(0, "Safemode Status", "Your computer is in AD Restore Mode.")
Edited by big_daddy
Link to comment
Share on other sites

You could check the SAFEBOOT_OPTION environment variable. Not sure if this will work for AD Restore Mode.

Woot! Way to go, Big MO. According to this it's set to DsRepair in AD Repair mode. Edited by DaveF

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...