MSFN Forum: Auto-Reboot Into SafeMode on WinXP - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Auto-Reboot Into SafeMode on WinXP Rate Topic: -----

#1 User is offline   TriPPiN 

  • Group: Members
  • Posts: 7
  • Joined: 14-September 06

Posted 14 September 2006 - 05:28 PM

Hi, I am making my unattended Win XP Pro Setup and I have been trying to find a way to reboot into safe mode to finish installing certain files. I want this to happen automatically after setup finishes and then pick up where it left off. In safe mode it should automatically install a few files then reboot back into normal mode and be finished.
I have searched my a** off for a command line switch to reboot into safe mode on xp like u can for 95/98 but to no avail.
My recent failed attempt involved using the utility included in xp pro called BOOTCFG.exe.
It worked partly by rebooting and then entering safemode but I have no idea to pick up the script or another script after in safe mode.
Here is the beginning of the script..
@echo off
ECHO.
ECHO REBOOTING INTO SAFE MODE
ECHO.
bootcfg /raw /a /safeboot:minimal /id 1
SHUTDOWN -r -f -t 01

This script must be ran before rebooting or every boot will be in safe-mode:
bootcfg /raw /fastdetect /id 1
SHUTDOWN -r -f -t 01

ANY HELP WOULD BE GREATLY APPRECIATED.. I AM AT A DEAD END :(

This post has been edited by TriPPiN: 15 September 2006 - 04:07 PM



#2 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 15 September 2006 - 07:07 AM

Thank you for sharing the code of rebooting into Safe Mode.

I didn't know it's that easy.

#3 User is offline   TriPPiN 

  • Group: Members
  • Posts: 7
  • Joined: 14-September 06

Posted 15 September 2006 - 04:10 PM

Still need help with this if anyone has the knowledge or the "drive" to figure this out.. Feel free to do so. :D

#4 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 15 September 2006 - 11:50 PM

It's easy! I just wanted to know the reboot code.

#5 User is offline   pmshah 

  • Member
  • PipPip
  • Group: Members
  • Posts: 292
  • Joined: 10-September 05

Posted 16 September 2006 - 05:15 AM

I use a utility called change.com to change the default time out from 30 seconds to 10 seconds in boot.ini

With the same utility I can also add the following line ...

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Safe Mode" /fastdetect /safeboot:minimal /sos /bootlog

to get option of safe boot. If This is placed as the first choice it will automatically boot to safe mode.

This post has been edited by pmshah: 16 September 2006 - 05:16 AM


#6 User is offline   IcemanND 

  • MSFN Junkie
  • Group: Super Moderator
  • Posts: 3,249
  • Joined: 24-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 16 September 2006 - 08:12 AM

the only thing I have ever seen that will run automatically on boot into safe mode are the runonceex registry keys. anything else would have to be run manually.

#7 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 16 September 2006 - 04:14 PM

RunOnceEX does not work, here!

#8 User is offline   RogueSpear 

  • OS: SimplyMEPIS
  • Group: Supreme Sponsor
  • Posts: 1,529
  • Joined: 18-September 04

Posted 16 September 2006 - 04:50 PM

I had a computer boot into safe mode unintentionally and it still ran my RunOnceEx scripts (which failed due to the unavailability of WMI). I wonder why it would work for some and not others?

Also, just in case it would be of use to anybody here, I've used a freeware utility for booting into safe mode that works pretty nice: BootSafe

#9 User is offline   TriPPiN 

  • Group: Members
  • Posts: 7
  • Joined: 14-September 06

Posted 16 September 2006 - 06:49 PM

Thanks for the responses so far yet the resolution is still a mystery. :}

Pmshah: That utility serves no more purpose than "bootcfg.exe" included with WinXP Pro.
... The extra switches you used are unnecessary.

Roguespear: I happened to find "Bootsafe" before this post and it doesn't have a switch for silent use.

If the RunOnceEx key works during safe mode then I will have my solution by simply changing my script to the following:

RebootScript
@ECHO OFF
regedit /s c:\progs.reg
bootcfg /raw /a /safeboot:minimal /id 1
SHUTDOWN -r -f -t 01


Progs.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx]
"Reboot-Normal"="bootcfg /raw /fastdetect /id 1"
"Script2"="c:\\SafeModeScript.cmd"



SafeModeScript.cmd

@ECHO OFF
Start notepad.exe
Start wordpad.exe
SHUTDOWN -r -f -t 01

This post has been edited by TriPPiN: 18 September 2006 - 12:29 AM


#10 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 17 September 2006 - 05:19 AM

I've run a careful test for the following 10 run points.

The first two run points have been executed in safe mode.

The rest of run points have been executed after rebooting in normal mode.

The table maintains the order they have been executed.

:===========:=============:
:-CMD from--:--SAFE MODE--:
:===========:=============:
:-1-LM-ROEX-:-----YES-----:
:-----------:-------------:
:-2-CU-ROEX-:-----YES-----:
:-----------:-------------:
:-3-LM-RO---:-----NO------:
:-----------:-------------:
:-4-LM-POL--:-----NO------:
:-----------:-------------:
:-5-LM-RUN--:-----NO------:
:-----------:-------------:
:-6-CU-POL--:-----NO------:
:-----------:-------------:
:-7-CU-RUN--:-----NO------:
:-----------:-------------:
:-8-STRTP-A-:-----NO------:
:-----------:-------------:
:-9-STRTP-U-:-----NO------:
:-----------:-------------:
:10-CU-RO---:-----NO------:
:-----------:-------------:


Abbreviations:

LM-ROEX=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
CU-ROEX=HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnceEX
LM-RO=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
LM-POL=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\Run
LM-RUN=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
CU-POL=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\Run
CU-RUN=HKCU\Software\Microsoft\Windows\CurrentVersion\Run
STRTP-A="%AllUsersProfile%\Start Menu\Programs\Startup"
STRTP-U="%UserProfile%\Start Menu\Programs\Startup"
CU-RO=HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce

#11 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,195
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 17 September 2006 - 10:03 AM

I once posted here on these boards a reboot to safe mode `compiled` batch file.

It ran a key in LM RunOnce for the revert to normal mode on next boot, so I know that LM RunOnce works everytime, (when you know how).

<Edit>
Here's the attachment from the said post
</Edit>

This post has been edited by Yzöwl: 17 September 2006 - 01:30 PM


#12 User is offline   TriPPiN 

  • Group: Members
  • Posts: 7
  • Joined: 14-September 06

Posted 18 September 2006 - 12:27 AM

Just tested the RunOneEx theory and it didn't work. Nothing that I put in either hklm or hkcu runoneex started up. The script that I wrote earlier would work perfectly if I could find a way to start a program at boot for safemode.

Also one more note.. when it reboots, a box comes up verifying if you want to enter safemode or not.. a method to bypass this box needs to be found for "silent" installation.

#13 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 18 September 2006 - 11:10 PM

I think you haven't used ROEX the correct way.
Please make another attempt using the following outlines.

RebootScript said:

@ECHO OFF
ECHO Rebooting into Safe Mode

SET LMROEX=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
REG ADD %LMROEX% /V TITLE /D "LM-ROEX SafeMoe" /f
REG ADD %LMROEX%\101 /vE /d "SafeMoe Installs" /f
REG ADD %LMROEX%\101 /v 1 /d %SystemDrive%\SafeModeScript.cmd /f

bootcfg /raw /a /safeboot:minimal /id 1
SHUTDOWN -r -f -t 01

Don't use your Progs.reg!

SafeModeScript.cmd said:

@ECHO OFF
ECHO Safe Mode Installs
Start notepad.exe
Start wordpad.exe

ECHO Rebooting into Normal Mode

bootcfg /raw /fastdetect /id 1
SHUTDOWN -r -f -t 01

This post has been edited by mazin: 18 September 2006 - 11:11 PM


#14 User is offline   Takeshi 

  • Legitchecking...
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,107
  • Joined: 09-September 04

Posted 19 September 2006 - 04:11 PM

mazin has a point about the progs.reg, it is incorrect.

Just wonder what it is that HAS to be installed/run in Safe Mode. :rolleyes:

#15 User is offline   TriPPiN 

  • Group: Members
  • Posts: 7
  • Joined: 14-September 06

Posted 19 September 2006 - 05:52 PM

Success!!! This issue is now resolved!

With the help of (mazin) I have solved this mystery and programs can be run in safe mode automatically during windows setup. I reduced the code to one batch file that works perfectly on Windows XP. This batch must be run as the LAST install on windows setup!

@ECHO OFF

:: CHANGE PROG* TO INSTALLER/S BEING USED

SET PROG1=notepad.exe
SET PROG2=calc.exe

:: DON'T CHANGE THIS STUFF!

SET LMROEX=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
SET A=bootcfg /raw /fastdetect /id 1
SET B=bootcfg /raw /safeboot:minimal /id 1
SET C=SHUTDOWN -r -f -t 01

REG ADD %LMROEX%\Installers /ve /d "SafeMode Installs" /f
REG ADD %LMROEX%\Installers /v 1 /d "cmd /c start /w /min cmd /c %PROG1%" /f
REG ADD %LMROEX%\Installers /v 2 /d "cmd /c start /w /min cmd /c %PROG2%" /f

REG ADD %LMROEX%\Normal /ve /d "Exiting Safe Mode" /f
REG ADD %LMROEX%\Normal /v 1 /d "%A%" /f
REG ADD %LMROEX%\Normal /v 2 /d "%c%" /f
%B%
%c%
exit


Thanks for the help MAZIN.

#16 User is offline   idbirch2 

  • Newbie
  • Group: Members
  • Posts: 48
  • Joined: 10-August 04

Posted 25 September 2006 - 08:28 AM

This is exactly what I have been looking for, I have some icon resource patching exe's that only work in Safe Mode due to WFP. I ended up having to make a shortcut called "Run me in Safe Mode" as a workaround but if this works (I will try when I get home), its genius! Thank you to everyone who contributed.

#17 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,195
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 25 September 2006 - 08:53 AM

Just bear in mind that this assumes that you are booted into the default boot.ini OS. It also assumes that your start up options on that booted OS are set a specific way. If you have altered your 'start up' boot.ini switches and /or are not booting to the usual partition or disk, then you will need to adjust the code to suit your particular set-up. This also means that ther code is not universal, and should not be included 'as is' in a 'do all' unattended setup.

#18 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 25 September 2006 - 04:50 PM

View PostYzöwl, on Sep 25 2006, 04:53 PM, said:

Just bear in mind that this assumes that you are booted into the default boot.ini OS. It also assumes that your start up options on that booted OS are set a specific way. If you have altered your 'start up' boot.ini switches and /or are not booting to the usual partition or disk, then you will need to adjust the code to suit your particular set-up. This also means that ther code is not universal, and should not be included 'as is' in a 'do all' unattended setup.

I, totally, agree!

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy