Jump to content











Photo
- - - - -

Offline change OS to boot in safemode+offline registry edit

bcd bcdedit bootice easybcd

  • Please log in to reply
2 replies to this topic

#1 protools_operator

protools_operator

    Newbie

  • Members
  • 11 posts
  •  
    Israel

Posted 14 March 2012 - 02:57 AM

I'm trying to figure out how to change nextboot or default boot of XP/Vista/Win7 to boot in safe mode by a script or a batch file.

Supposing XP is the easiest part - batch file to process BOOT.INI,
After researching a bit I found that there is a way to handle Vista's/Win7 by WMI classes using VB scripts.
I also found BootICE which has a command line and handles XP/NT and Vista/Win7 but I can't find any tutorial for using it.

I understand that it's not possible to use bcdedit.exe from within LiveXP and that's what I'm looking for.

So my best options will be BootICE - if it can do so, or writing a script to make:

Identify OS type (XP-BOOT.ini or Vista/7- BCD)
edit the corresponding Boot Record to boot in safe mode.

Also for my purpose I need to change a few registry enteries offline for the OS to RunOnce a script,
What should be the best method - using
Offline NT Password & Registry Editor or using a batch script to use reg command from

WINPE instead of LiveXP?

I hope I posted it in the right forum hope to read some suggestions.
Thanks in advance!

#2 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 14 March 2012 - 07:31 AM

Supposing XP is the easiest part - batch file to process BOOT.INI

Something like:
@echo off

setlocal

attrib -r -h -s %systemdrive%\boot.ini

ren boot.ini boot.bak

set inifile="%systemdrive%\boot.ini"

echo [boot loader] >> %inifile%

echo timeout=5 >> %inifile%

echo default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS >> %inifile%

echo. >> %inifile%

echo [operating systems] >> %inifile%

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

echo multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows XP Professional" /fastdetect /NoExecute=OptIn >> %inifile%

attrib +r +h +s %systemdrive%\boot.ini

endlocal

More options:

Mode: Safe Mode
Switch: /safeboot:minimal /sos /bootlog /noguiboot
Mode: Safe Mode with Networking
Switch: /safeboot:network /sos /bootlog /noguiboot
Mode: Safe Mode with Command Prompt
Switch: /safeboot:minimal(alternateshell) /sos /bootlog /noguiboot
Mode: Enable Boot Logging
Switch: /bootlog
Mode: Enable VGA Mode
Switch: /basevideo
Mode: Directory Services Restore Mode (Domain Controllers Only)
Switch: /safeboot:dsrepair /sos
Mode: Debugging Mode
Switch: /debug

Possibly useful:
http://technet.micro...y/bb490870.aspx


I understand that it's not possible to use bcdedit.exe from within LiveXP and that's what I'm looking for.

Works from LiveXP:
@echo off

setlocal

set title=Rescue Options

for %%d in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (

if exist %%d:\boot\bcd set bdr=%%d:\

)

set bcd=%bdr%boot\bcd

set exe=%bdr%Windows\System32\bcdedit.exe

copy %bdr% %bdr%bak

%exe% /store %bcd% /create /d "%title%" /application bootsector

for /f "tokens=3" %%a in ('%exe% /store %bcd% /create /d "%title%" /application bootsector') do set guid=%%a

%exe% /store %bcd% /set %guid% device boot

%exe% /store %bcd% /set %guid% path \grldr.mbr

%exe% /store %bcd% /displayorder %guid% /addlast

if not exist %bdr%xpe md %bdr%xpe

xcopy xpe\*.* %bdr%xpe /i /y

xcopy menu\*.* %bdr% /i /y

endlocal


Identify OS type (XP-BOOT.ini or Vista/7- BCD)

set vbs="%temp%\filever.vbs"

set file="%systemroot%\system32\ntdll.dll"

echo Set oFSO = CreateObject("Scripting.FileSystemObject") >%vbs%

echo WScript.Echo oFSO.GetFileVersion(WScript.Arguments.Item(0)) >>%vbs%

for /f "tokens=*" %%a in (

'cscript.exe //Nologo %vbs% %file%') do set filever=%%a

del %vbs%

for /f "tokens=1 delims=. " %%a in ("%filever%") do set winver=%%a

if /i '%winver%'=='5' goto n5

if /i '%winver%'=='6' goto n6


Also for my purpose I need to change a few registry enteries offline for the OS to RunOnce a script,
--
WINPE instead of LiveXP?

Why not LiveXP? reg load should work http://www.petri.co...._windows_xp.htm
  • Brito likes this

#3 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 14 March 2012 - 09:45 AM

Or using the Offline Registry tool:
http://reboot.pro/11212/
http://reboot.pro/11312/

:cheers:
Wonko




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users