Maelstorm Posted May 10, 2006 Share Posted May 10, 2006 I have ran into a real problem. On my new computer when I do an unattended install, it seems that the drive letters are changing across reboots. In GUI setup, the DVD drive is H:, but when RegOnceEX runs, it gets reordered to D:, so because RegOnceEX is looking to H:, it fails because it cannot find the scripts. The computer does have a USB card reader installed.What I don't understand is why the 4 drives on the USB card reader is showing up as D-G with the DVD as H during GUI setup when during first login it reorders with the DVD being D and the card reader being E-H. Any ideas as to why this is happening and how to fix it? Link to comment Share on other sites More sharing options...
mmarable Posted May 10, 2006 Share Posted May 10, 2006 Unfortunatly, "who knows what evil lurks in the hearts of men..." and how exactly Windows decides it's drive letter assignments.It's a hassle and I don't know if it'll work with the card reader or not, but you can use diskpart with a script to assign all the drive letters the way you want them.Or, use a variable like %CDROM% in your runonce lines, but instead of determining the DVD's drive letter when you build the RunOnceEx, determine it when it executes.Your RunOnceEx lines will have "%CDROM%\Apps\....\setup.exe", but the very first thing, before any installs begin, have it run the script that selects the DVD's drive letter and assigns it to %CDROM%. This should work for you. So, even though the drive letters change, the %CDROM% variable isn't pupulated until first logon. Link to comment Share on other sites More sharing options...
Maelstorm Posted May 10, 2006 Author Share Posted May 10, 2006 Unfortunatly, "who knows what evil lurks in the hearts of men..." and how exactly Windows decides it's drive letter assignments.My question is why does it reorder the drive letters during the install?It's a hassle and I don't know if it'll work with the card reader or not, but you can use diskpart with a script to assign all the drive letters the way you want them.This disk is to be used with multiple computers, each with a different config. So unless diskpart can analyze the drive map and make some decisions, it will be useless.Or, use a variable like %CDROM% in your runonce lines, but instead of determining the DVD's drive letter when you build the RunOnceEx, determine it when it executes.Your RunOnceEx lines will have "%CDROM%\Apps\....\setup.exe", but the very first thing, before any installs begin, have it run the script that selects the DVD's drive letter and assigns it to %CDROM%. This should work for you. So, even though the drive letters change, the %CDROM% variable isn't pupulated until first logon.AFAIK, you cannot place a %CDROM% in a string to be added to the registry because CMD.exe will try to interpret it when it's encountered.But, that does give me an idea on how to get around this...Use my SYSTEM-PREPARE.CMD script from RunOnceEX to determine the current drive letter and then stuff the RegOnceEX keys with the correct data. I would have to use placeholders to hold each entry so it appears on the list. This is going to be *VERY* dependent on RegOnceEX's behavior.We know that RegOnceEX reads all the reg data at once because it presents the list of items to perform. But, that's just titles though. Does it also read the execution data at the same time and store it in a buffer, or does it read it from the registery one line at a time? And if this does work, then hope to God that Microsoft doesn't change it because then we will be screwed. Link to comment Share on other sites More sharing options...
Maelstorm Posted May 10, 2006 Author Share Posted May 10, 2006 Well that method didn't work. It seems that RegOnceEX reads all the data in the registery at once and then stores it in a buffer, so subsequent modifications of the registery doesn't have an effect. I still have a couple of ideas rattling around inside my head on how to resolve this.An idea that I have it using a VBS or AutoIT script to determine what the CDROM drive is and then call the scripts in question according to what command line parameters were given. Something like this:CDEXEC.exe x INSTALL-RC.CMDWhere x is either 0 or 1 which indicates if the execution should be forked or not. It looks for the script in the default scripts directory on the CDROM drive, and if it's not found, it shows an error.I didn't want to have to do it this way, but now I have no choice in the matter. Link to comment Share on other sites More sharing options...
ophiel Posted May 10, 2006 Share Posted May 10, 2006 (edited) he gave you a perfectly good way to accomplish what you want.this is my cmdlines.txt:[COMMANDS]"RunOnceEx.cmd"this is first line in my RunOnceEx.cmd:FOR %%i IN (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 %%i:\2Fast_XP.nfo SET CDROM=%%i:in my RunOnceEx.cmd i then run them like so:SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY% /V TITLE /D "Installing Applications..." /fREG ADD %KEY%\005 /VE /D ".Net Framework 2.0" /fREG ADD %KEY%\005 /V 1 /D "%cdrom%\Install\Net20\install.exe /q" /fit works like a charm. when using a forum you should perhaps ignore what you think you know and be more open to suggestion. Edited May 10, 2006 by ophiel Link to comment Share on other sites More sharing options...
Maelstorm Posted May 10, 2006 Author Share Posted May 10, 2006 he gave you a perfectly good way to accomplish what you want.this is my cmdlines.txt:[COMMANDS]"RunOnceEx.cmd"this is first line in my RunOnceEx.cmd:FOR %%i IN (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 %%i:\2Fast_XP.nfo SET CDROM=%%i:in my RunOnceEx.cmd i then run them like so:SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY% /V TITLE /D "Installing Applications..." /fREG ADD %KEY%\005 /VE /D ".Net Framework 2.0" /fREG ADD %KEY%\005 /V 1 /D "%cdrom%\Install\Net20\install.exe /q" /fI am allready doing this...well something similar since the original code was written along time ago (see below).The problem is that Windows is changing the drive letter mapping across reboots from GUI setup and first login.In GUI setup:C: HDD: card slot 1E: card slot 2F: card slot 3G: card slot 4H: DVDAfter the reboot to first login:C: HDD: DVDE: card slot 1F: card slot 2G: card slot 3H: card slot 4As you can see, the driver letter map changed after the reboot. So when RunOnceEX executes at first login, it's looking for the files on drive H when they have been moved to drive D.Here's what I'm using:cmdlines.txt[Commands]"WINSETUP.CMD"WINSETUP.CMD@ECHO OFFREM Check the command line argument. If nothing is given, then we are going to do aREM live install from the DVD-ROM. If TST is given, then we are in the testREM environment on the harddisk and the base path is different.IF /I "%1"=="" GOTO :STARTIF /I "%1"=="TST" GOTO :TESTGOTO :ERRORREM This is the DVD-ROM Installation:STARTREM Hide the command windowCMDOW @ /HIDREM Find our CD-ROM Drive and set the evnironment variableSET CHECKFILE=win51ip.SP2IF EXIST C:\%CHECKFILE% SET CDROM=C:IF EXIST D:\%CHECKFILE% SET CDROM=D:IF EXIST E:\%CHECKFILE% SET CDROM=E:IF EXIST F:\%CHECKFILE% SET CDROM=F:IF EXIST G:\%CHECKFILE% SET CDROM=G:IF EXIST H:\%CHECKFILE% SET CDROM=H:IF EXIST I:\%CHECKFILE% SET CDROM=I:IF EXIST J:\%CHECKFILE% SET CDROM=J:IF EXIST K:\%CHECKFILE% SET CDROM=K:IF EXIST L:\%CHECKFILE% SET CDROM=L:IF EXIST M:\%CHECKFILE% SET CDROM=M:IF EXIST N:\%CHECKFILE% SET CDROM=N:IF EXIST O:\%CHECKFILE% SET CDROM=O:IF EXIST P:\%CHECKFILE% SET CDROM=P:IF EXIST Q:\%CHECKFILE% SET CDROM=Q:IF EXIST R:\%CHECKFILE% SET CDROM=R:IF EXIST S:\%CHECKFILE% SET CDROM=S:IF EXIST T:\%CHECKFILE% SET CDROM=T:IF EXIST U:\%CHECKFILE% SET CDROM=U:IF EXIST V:\%CHECKFILE% SET CDROM=V:IF EXIST W:\%CHECKFILE% SET CDROM=W:IF EXIST X:\%CHECKFILE% SET CDROM=X:IF EXIST Y:\%CHECKFILE% SET CDROM=Y:IF EXIST Z:\%CHECKFILE% SET CDROM=Z:REM Set our base DIR and call the main system script.SET BASEDIR=%CDROM%\INSTALLSTART /WAIT %SYSTEMROOT%\System32\CMD.EXE /C %BASEDIR%\SCRIPTS\SYSTEM-INSTALL.CMD %CDROM% %BASEDIR%GOTO :EOFREM This is for our test environment:TEST@ECHO ONSET CDROM=E:SET BASEDIR=%CDROM%\Deployment\CDROM\INSTALLSTART /WAIT %SYSTEMROOT%\System32\CMD.EXE /C %BASEDIR%\SCRIPTS\SYSTEM-INSTALL.CMD %CDROM% %BASEDIR%GOTO :EOFREM This is only called if there is a command line argument error:ERRORECHO Command Line ErrorECHO Valid Options are nothing and TST for install and testGOTO :EOFSYSTEM-INSTALL.CMD@ECHO OFFCMDOW @ /HIDREM Get Our Command Line ParametersSET CDROM=%1SET BASEDIR=%2REM Setup Our EnvironmentSET SCRIPTSDIR=%BASEDIR%\SCRIPTSSET TOOLSDIR=%BASEDIR%\TOOLSSET TEMPDIR=%SYSTEMDRIVE%\TMPSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEXREM Make sure that our temp directory is presentIF /I NOT EXIST %TEMPDIR% MKDIR %TEMPDIR%REM Set The Working DirectoryCHDIR %SCRIPTSDIR%REM Install TweaksSTART /WAIT %SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\TWEAK-SYSTEM.CMD %BASEDIR%START /WAIT %SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\TWEAK-REGISTRY.CMD %BASEDIR%START /WAIT %SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\TWEAK-POWER.CMD %BASEDIR%START /WAIT %SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\TWEAK-FILESYSTEM.CMD %BASEDIR%REM RegOnceEXREM Prepare the Install **MUST BE FIRST**REG ADD %KEY% /V TITLE /D "Installing Software" /fREG ADD %KEY%\001 /VE /D "Preparing Installation..." /frem REG ADD %KEY%\001 /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\SYSTEM-PREPARE.CMD %BASEDIR%" /fREG ADD %KEY%\001 /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %TEMPDIR%\SYSTEM-PREPARE.CMD %BASEDIR%" /fREG ADD %KEY%\002 /VE /D "Set Video Resolution" /fREG ADD %KEY%\002 /V /1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\SYSTEM-GUIKILLER.CMD %BASEDIR%"REG ADD %KEY%\003 /VE /D "Fork Image Rotator" /fREG ADD %KEY%\003 /V /1 /D "%SYSTEMROOT%\System32\CMD.EXE /C START CMD.EXE /C %SCRIPTSDIR%\SYSTEM-IMAGEROTATE.CMD %BASEDIR%"rem REG ADD %KEY%\004 /VE /D "Set Background Image" /frem REG ADD %KEY%\004 /V /1 /D "%SYSTEMROOT%\System32\CMD.EXE /C START CMD.EXE /C %SCRIPTSDIR%\SYSTEM-SETWALLPAPER.CMD %BASEDIR%"REM Install CD Files and Recovery ConsoleREG ADD %KEY%\100 /VE /D "Installing Windows CD-ROM" /fREG ADD %KEY%\100 /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\INSTALL-CDROM.CMD %CDROM% %BASEDIR%" /fREG ADD %KEY%\101 /VE /D "Installing Recovery Console" /fREG ADD %KEY%\101 /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\INSTALL-RC.CMD %CDROM% %BASEDIR%" /fREM Install SoftwareSET SEQUENCE=110IF /I EXIST %SCRIPTSDIR%/MAIN-DRIVER.XML CALL :INSTALLDRIVERSET SEQUENCE=111IF /I EXIST %SCRIPTSDIR%/MAIN-HOTFIX.XML CALL :INSTALLHOTFIXSET SEQUENCE=112IF /I EXIST %SCRIPTSDIR%/MAIN-FONTS.XML CALL :INSTALLFONTSET SEQUENCE=113IF /I EXIST %SCRIPTSDIR%/MAIN-MEDIA.XML CALL :INSTALLMEDIASET SEQUENCE=114IF /I EXIST %SCRIPTSDIR%/MAIN-SOFTWARE.XML CALL :INSTALLSOFTWAREREM Copy over additional filesREG ADD %KEY%\900 /VE /D "Installing Additional Files" /fREG ADD %KEY%\900 /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\INSTALL-FILES.CMD %BASEDIR%" /fREM Install ScriptsREG ADD %KEY%\901 /VE /D "Installing Scripts" /fREG ADD %KEY%\901 /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\INSTALL-SCRIPTS.CMD %BASEDIR%" /fREM Set File PermissionsREG ADD %KEY%\902 /VE /D "Set File Permissions" /fREG ADD %KEY%\902 /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\SYSTEM-PERMISSIONS.CMD %BASEDIR%" /fREM Sequence 990-999 **MUST BE LAST**REM Cleanup and RebootREG ADD %KEY%\994 /VE /D "Cleaning Up" /fREG ADD %KEY%\994 /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\SYSTEM-CLEANUP.CMD %BASEDIR%" /fREG ADD %KEY%\995 /VE /D "Defragmenting System Harddisk" /fREG ADD %KEY%\995 /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\SYSTEM-DEFRAG.CMD" /fREG ADD %KEY%\996 /VE /D "Change Registration Information" /fREG ADD %KEY%\996 /V 1 /D "%TOOLSDIR%\MISC\CHGREG.EXE" /fREG ADD %KEY%\997 /VE /D "Set Desktop Image"REG ADD %KEY%\997 /V /1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\SYSTEM-SETWALLPAPER.CMD" /fREG ADD %KEY%\998 /VE /D "Fork Detached Program" /fREG ADD %KEY%\998 /V /1 /D "%SYSTEMROOT%\System32\CMD.EXE /C START CMD.EXE /C %SCRIPTSDIR%\SYSTEM-DETACHED.CMD %BASEDIR%"REG ADD %KEY%\999 /VE /D "Rebooting..." /fREG ADD %KEY%\999 /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\SYSTEM-REBOOT.CMD" /fGOTO :EOF:INSTALLDRIVERREG ADD %KEY%\%SEQUENCE% /VE /D "Installing Drivers" /fREG ADD %KEY%\%SEQUENCE% /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\INSTALL-DRIVER.CMD %BASEDIR%" /fGOTO :EOF:INSTALLHOTFIXREG ADD %KEY%\%SEQUENCE% /VE /D "Installing Hotfixes" /fREG ADD %KEY%\%SEQUENCE% /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\INSTALL-HOTFIX.CMD %BASEDIR%" /fGOTO :EOF:INSTALLFONTREG ADD %KEY%\%SEQUENCE% /VE /D "Installing Fonts" /fREG ADD %KEY%\%SEQUENCE% /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\INSTALL-FONTS.CMD %BASEDIR%" /fGOTO :EOF:INSTALLMEDIAREG ADD %KEY%\%SEQUENCE% /VE /D "Installing Media" /fREG ADD %KEY%\%SEQUENCE% /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\INSTALL-MEDIA.CMD %BASEDIR%" /fGOTO :EOF:INSTALLSOFTWAREREG ADD %KEY%\%SEQUENCE% /VE /D "Installing Software" /fREG ADD %KEY%\%SEQUENCE% /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\INSTALL-SOFTWARE.CMD %BASEDIR%" /fGOTO :EOFREM RunOnceEX install template:INSTALLREG ADD %KEY%\%SEQUENCE% /VE /D "Installing " /fREG ADD %KEY%\%SEQUENCE% /V 1 /D "%SYSTEMROOT%\System32\CMD.EXE /C %SCRIPTSDIR%\INSTALL-.CMD %BASEDIR%" /fGOTO :EOFAnd one of the install files:INSTALL-HOTFIX.CMD@ECHO OFFCMDOW @ /HIDREM Set VariablesSET NAME=HOTFIXREM Get Command Line ParametersSET BASEDIR=%1REM Setup Our EnvironmentSET XPLODEDIR=%BASEDIR%\TOOLS\XPLODESET SCRIPTSDIR=%BASEDIR%\SCRIPTSSET LOADFILE=%SCRIPTSDIR%\MAIN-%NAME%.XMLREM Check for the XML file that XPlode needs to seeIF /I NOT EXIST %LOADFILE% GOTO :EOFREM Run InstallationSTART /WAIT %XPLODEDIR%\XPLODE.EXE /xml:"%LOADFILE%" /log:"%SYSTEMROOT%\XPlode.log"REM CleanupSYNC.EXEit works like a charm. when using a forum you should perhaps ignore what you think you know and be more open to suggestion.Um...I am open to suggestions, which is why I posted here in the first place. Not to sound rude or anything, but read the original post and you will see what I'm talking about. Link to comment Share on other sites More sharing options...
cancerface Posted May 10, 2006 Share Posted May 10, 2006 At GUIRunOnce I am installing ActivePerl then I am running among other things a rather old Perl script that changes the CD drive letter to R:Upon reboot my cdrom is set to R Since my source is in %cdrom%\setup\wxpsp2 I patch my registry so that windows knows where to find the files:reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup" /v "SourcePath" /t REG_SZ /d R:\SETUP\WXPSP2\ /Freg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup" /v "ServicePackSourcePath" /t REG_SZ /d R:\SETUP\WXPSP2 /Freg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "SourcePath" /t REG_SZ /d R:\SETUP\WXPSP2\i386 /FYou could write something similar in VB if you don't want to use Perl.Hope this helpsCF Link to comment Share on other sites More sharing options...
ophiel Posted May 11, 2006 Share Posted May 11, 2006 heh, sorry for being a dick, but it seemed like you were ignoring good advice.the code you posted should work flawlessly, it's very similar to what i do.did you try logging the output of your scripts to find any errors?(i.e. winsetup.cmd >>log.txt) Link to comment Share on other sites More sharing options...
Maelstorm Posted May 12, 2006 Author Share Posted May 12, 2006 The problem is not really in the script. The registery is loaded with the correct values. I actually get an error from RegOnceEX because it says that "H:\INSTALL\TOOLS\MISC/CHGREG.EXE" cannot be found. That's how I know what was programmed into the registery. Furthermore, I'm able to do <CTRL>-<ALT>-<DEL> to bring up task manager and open up Explorer. The system shows that the DVD drive is D: at that point. Furthermore, when I open RegEdit and look at the remaining data in HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEX, it shows everything pointing to H:.I think that I might have come up with something though. I'll let you know how it works. Link to comment Share on other sites More sharing options...
ZileXa Posted June 20, 2006 Share Posted June 20, 2006 I think everyone has this problem, but many people might still not understand:Like TS said..On a new PC, a new harddisk (1 harddisk!) and DVD drive (1 DVD drive!) without partitions, I insert my unAttended CD run WIndows Setup, create 2 partitions and install windows on the first one.After install has finished completely, I check My Computer and I see this:C:\ = hard driveD:\ = CD/DVD driveE:\ = hard drive, 2nd partition.This is not what I want... I want the harddisk partitions to have the first letters.. then CD/DVD drive!So how can I modify Windows Setup not to give the CD/DVD drive(s!, or card slots) priority when creating new partitions? Link to comment Share on other sites More sharing options...
wim Posted October 17, 2008 Share Posted October 17, 2008 (edited) I have written a vb script for switching drive letters.See post http://www.msfn.org/board/Switching-drive-...748#entry810748Wim Edited November 12, 2008 by wim Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now