Jump to content

Can someone help me with a simple guide to using


Recommended Posts


ok the quick basics

cmdlines.txt goes in the $OEM$ folder

add this to cmdlines.txt

[COMMANDS]
".\INSTALLS.CMD"

now create a batch file called INSTALLS.CMD and put that in the $OEM$ folder then you can add waht you want to the batch file which will run around the 13 mintue mark in the XP Setup Screen.

EDIT: remeber that the stuff you put in the batch file must be under the $OEM$\$1\install folder.

Link to comment
Share on other sites

Using CMDLINES.TXT.

The CMDLINES.TXT file is parsed by Windows Setup after copying the $OEM$\$* directories and included files, and after running aditional inf files that may be listed in DOSNET.INF (SVCPACK.INF for example - the Slipstream Hotfix Inf file), at around the T-13 minutes mark. The syntax used is a subset of that used in normal .BAT and .CMD files, and for that reason it is easier to call a .CMD file from CMDLINES.TXT, where the syntax is richer and more familiar. The first line of CMDLINES.TXT should read [COMMANDS]. Additional lines could contain calls to various programs and setup files, wrapped in quotes. However, it seems to have become a de-facto standard to simply call one command script that contains all subsequent commands and program calls. The name of the called file listed in CMDLINES.TXT is user definable, but an 8.3 named file (FILENAME.EXT) listed in the same directory is the simplest and safest. For the sake of this example, I will name the .CMD file INSTALLS.CMD. My complete CMDLINES.TXT should now look like this:

[COMMANDS]
".\INSTALLS.CMD"

You could add multiple calls to the CMDLINES.TXT file, but is unnecessary, and complicates the debugging process.

INSTALLS.CMD

This is a standard command script file, using the normal command script syntax. You are not limited in script instructions nor program calls in this file itself, though certain programs/instructions may not work, due to the unfinished state of the windows setup. An example is the NET USE command, which you cannot use, as the Workstation service has not been started, and is required by the NET USE command. In terms of file manipulation, and program installation, INSTALLS.CMD will usually be sufficient for your installation needs. This file can often simply be the file that many use to install programs, called from the GuiRunOnce section of WINNT.SIF.

The advantages of this method are that the system is logged onto the Default User profile, and changes made there are subsequently copied over to each new user, including the administrator, as that user is created. At the point CMDLINES.TXT is parsed, the only user profile that exists is the Default User profile. Installations from the GuiRunOnce WINNT.SIF section will not necessarily be installed for all users.

The major disadvantage I have seen to this method is that is perhaps a little more complicated. I do not find this to be the case personally, but judging from comments here …

Following are some pointers, and an attempt to clear up some misconceptions of this process. This is based on my installations, as well as certain MS documents that I have read (though they are not always correct …). Let me note that I NEVER use a $1, $$, C, or such directory in $OEM$, thus I cannot be certain that what I mention here is the same for those of you using these $OEM$ sub-directories as the means to copy files to your hard disk.

1) When CMDLINES.TXT is parsed, thus the call to INSTALLS.CMD made, the working directory is <CDDRIVE>:\$OEM$.

2) The only files copied from $OEM$ to the hard disk are those included in reserved subdirectories ($$, $1, C, D, etc). Files in the root of $OEM$ and subsequent, non-reserved directories (i.e. <CDDRIVE>:\$OEM$\SETUPS\) are NOT copied to the HDD.

3) You do not need to place your setup programs in $OEM$\$1\Installs. This is only interesting to do if you wish to access these programs AFTER the GUI reboot, when you are no longer able to access files on the CD, as you cannot know the drive letter (USUALLY D:, but it is hardware dependent). You can access the files on the CD from CMDLINES.TXT using relative paths (i.e. “.\SETUPS\SETUP1.EXE"), and they do NOT need to be copied to the HDD first. The reason to copy the files to the HDD is that there is not an easy mechanism to know which drive letter the CD has been assigned during the post GUI Reboot portion of setup.

4) A list of available environment variable for CMDLINES.TXT calls follows:

D:\$OEM$>SET
ALLUSERSPROFILE=C:\Documents and Settings\All Users
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=NEWXP
ComSpec=C:\WINDOWS\system32\cmd.exe
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS
ProgramFiles=C:\Program Files
PROMPT=$P$G
SystemDrive=C:
SystemRoot=C:\WINDOWS
Upgrade=False
USERPROFILE=C:\Documents and Settings\Default User
windir=C:\WINDOWS
__PROCESS_HISTORY=C:\WINDOWS\system32\setup.exe

D:\$OEM$>

5) This is the ideal place to make changes to the HKCU settings that will not "stick" when made after this point, namely the Explorer and Internet Explorer default settings. This is because both these applications (so it appears to me...) save their settings when logging off. At the point the CMDLINES.TXT calls are made, contrary to the GuiRunOnce calls, the Explorer shell is not graphically "active", thus does not save settings that overwrite your own registry imports.

For the non-believers and pros who know better, please note that 1 above can be verified by adding the following line to INSTALLS.CMD

START "DOS BOX" /WAIT CMD

A DOS window will open during setup, and you will see the working directory. From a DOS window points 2 and 3 can be verified. If you do not want to open a DOS window from INSTALLS.CMD as shown above … just type SHIFT-F10 at this point, and a DOS window will open.

This is based on my installation method (NO $OEM$\$...), and the information I share here is based on classic reverse engineering techniques more than relying on (often incorrect or incomplete) official documentation. I do everything from the CMDLINES.TXT call, and it works for me. I do not use the GuiRunOnce for anything: I have completed all I need before this point. An example of what can be done at this point (my INSTALLS.CMD file):

@ECHO OFF

TITLE Post Install Setup

:: ---------- Update MS Components

ECHO Starting DirectX 9 Install.
START "DirectX 9 Install" /WAIT ".\DIRECTX\DXSETUP.EXE" /opk

ECHO Starting Internet Explorer 6 Install.
START "Internet Explorer 6 Install" /WAIT ".\IE\ie6setup.exe" /C:"IE6WZD /S:""#e"" /Q:A /R:N"

ECHO Media Player and Movie Maker Install.
START "MP MM" /WAIT ".\SVCPACK\WMP9_MM2.exe"

ECHO Installing Dot Net.
START "Dot Net" /WAIT ".\SVCPACK\dotnetfx.exe" /Q:A /c:"install /q"

ECHO Installing MDAC 2.8.
START "MDAC" /WAIT ".\SVCPACK\MDAC_TYP.EXE" /Q:A /c:"dasetup.exe /q /n"

ECHO Updating Microsoft JavaVM.
START "JAVA" /WAIT ".\SVCPACK\msjavwu.exe" /Q:A /R:N

ECHO Hotfixing.
START "HOTFIX" /WAIT ".\SVCPACK\KB819639.exe" /Q:A /R:N

:: ---------- Adjust the Registry

ECHO Importing Registry Files.
START "" /WAIT REGEDIT /S ".\SVCPACK\HKLM.reg"
START "" /WAIT REGEDIT /S ".\SVCPACK\HKCR.reg"
START "" /WAIT REGEDIT /S ".\SVCPACK\HKCU.reg"

:: ---------- Remove files I do not like

ECHO Removing useless shortcuts.
RMDIR "%ALLUSERSPROFILE%\Start Menu" /S /Q
RMDIR "%USERPROFILE%\Start Menu" /S /Q

ECHO Removing useless folders.
RMDIR "%systemdrive%\Program Files\ComPlus Applications" /S /Q
RMDIR "%systemdrive%\Program Files\Online Services" /S /Q
RMDIR "%systemdrive%\Program Files\Uninstall Information" /S /Q

ECHO Removing HotFix Log Files.
DEL "%SYSTEMROOT%\*.log" /Q /F
DEL "%SYSTEMROOT%\*.txt" /Q /F
DEL "%SYSTEMROOT%\*.tmp" /Q /F
DEL "%SYSTEMROOT%\TEMP\*.*" /Q /F
DEL "%USERPROFILE%\*.log" /Q /F

:: ---------- Add files I do like

ECHO Installing Custom Windows Files.
XCOPY ".\PROFILES\All Users\*.*" "%ALLUSERSPROFILE%\" /E /C /Y /Q /H
XCOPY ".\PROFILES\Default User\*.*" "%USERPROFILE%\" /E /C /Y /Q /H
COPY ".\SVCPACK\HKCU.reg" "%systemroot%\System32\"

:: ---------- Fix up the User Accouints

ECHO Deleting Useless Accounts.
NET USER aspnet /DELETE
NET USER SUPPORT_388945a0 /DELETE

ECHO Setting up Users.
NET USER SysAdmin SysAdmin /ADD /COMMENT:"System Administrator Account" /PASSWORDREQ:YES
NET USER User User /ADD /COMMENT:"Local User Account" /PASSWORDREQ:YES
NET LOCALGROUP Administrators SysAdmin /ADD
NET USER Administrator /ACTIVE:NO

EXIT

Bottom line ... whatever floats your boat. The better method is that with which you feel more comfortable, and that which best meets your requirements. I have multi-user systems, and insist that all my modifications are valid for all users. I have no need for the GuiRunOnce, you may.

Link to comment
Share on other sites

Greenmachine, I gotta say that post is the best yet regarding changing settings for default user. (which is a problem with other methods)

I put a lot of time into the guirunonce method but I think your clear explanation has swung it for me to go with your method.

cheers.

Link to comment
Share on other sites

For the non-believers and pros who know better, please note that 1 above can be verified by adding the following line to INSTALLS.CMD

Greenmachine: Yes, you are correct with a CD install. I do not deal with many CD installs and that is why we had an argument about this. In a network installation or using RIS it is completely different. At this point of the setup Windows cannot authenticate to network drives/servers so in such installations these files ARE copied locally. Sorry to have caused a fuss over this days ago.

Link to comment
Share on other sites

Thanks, pmcx9. I was begining to think that there hadn't been a reply because no one finished reading it - I realized after that perhaps "Simple Guide" was not the best description.

Fear not, I think that most of the work you put into the GuiRunOnce code and calls can be used here with little or no modification. I have edited the post above to include a list of available environment variables.

Perhaps I should not be the one to say which method is "better": I have never tried any calls from GuiRunOnce...

Last point: I just learned about the shift-f10 thing. Could have saved me hours...

un4given1: you can change your name to 4given1. Peace. (I was that obvious in my finger pointing...?)

Link to comment
Share on other sites

not wishing to go off topic here;

I have just tried this method and the installation wouldn't allow me to overcopy the ntuser.dat file i have from a tweaked user to the default user's directory. I presume this would contain a lot of the visual tweaks etc.

Could I try renaming the default user directory first to default user.old perhaps and then recreate the directory using my personalised one as per this section of installs.cmd? Or is the ntuser.dat in use at this stage of an installation and there is nothing I can do?

The default user.exe is a self extracting silent rar of a previously saved personalised user profile.....and yes i did ensure "Everyone" can use it when saving.

CLS
@echo off
ECHO.
ECHO Renaming Default User Directory
ren "%systemdrive%\documents and settings\default user" "%systemdrive%\documents and settings\default user.old"
ECHO.
ECHO Creating a custom default user
ECHO Please wait...
start /wait %systemdrive%\install\defaultuser.exe

rem Change this username
set _USER=Dood
net user %_USER% "" /add >nul
net localgroup administrators "%_USER%" /add>nul
%SystemRoot%\system32\reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultUserName" /d "%_USER%" /f
%SystemRoot%\system32\reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultUserPassword" /d "" /f
%SystemRoot%\system32\reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminLogon" /d "1" /f

This thread is in danger of getting lost in the myre of less important threads and after weeks of reading the unattended pages it is the first one for a while that has really got my attention as it is an alternative way. Perhaps Aaron might sticky this if it develops?

Link to comment
Share on other sites

When using the CMDLINES.txt approach it installs apps for all users not only the default account, so if you used the Guirunonce part of the winnt.sif it will only install apps into the loggedon account, or if the apps support multiple accounts then and only then are they installed for multiple users.....so basically the best approach is to use them in conjuntion with each other, create the user account with CMDLINES.txt and use guirunonce to install the apps and tweaks....

Link to comment
Share on other sites

@sunil

My unattended install is aimed at a single user so installing appz to default users or multiple is irrelevant for me but thanks for the heads up as it may affect others who read this thread. I am trying to think of an app I have used that installs to a single person. Getright is the only one I can think of that prompts when creating a new user on a mature rig!

The visual settings I am trying to get as far as I know can't be applied to the HKCU while active as they won't stick. I may be wrong here.

Such things as unchecking of "fade effect" for appearance and getting the explorer shortcut onto the taskbar are what I am after and Greenmachines approach seems best for this.

Link to comment
Share on other sites

Hmmm. I know that I mentioned copying the NTUSER.DAT file earlier (never tried it) ... but I must have been drunk: It would discredit afore mentioned theories! I would think that there is no way you can copy over it as such: it is locked by the system. There may be a way to add it to a queue that is used by hotfixes and installs to be replaced on next boot, but that would be beyond my scope (though others here probably DO know how). However, if you load the default user's hive, you will see that there is not that much to it. You should be able to easily weed out what you don't need, and just export/import as usual. I would also suggest importing any settings from a (more or less) clean machine, to avoid importing unnecessary settings and other registry clutter. All the other files should not be a problem. I like to delete all shortcuts, All User's and Default User's, and then add them arranged as I like to the All User profile. This also has the advantage that only administrators can move/delete them, yet they are always availible for all the users. It depends on your users, and how "Hitlerian" approach you must take, but it sure does reduce maintenance.

Just looked at your last lines of code. First, let me congratulate you: this code is short enough that I actually read it to the end (you out did me above). I always use regedit instead of reg, but it looks like you are changing the users name. I have to look into that. For security reasons, one should (theoretically) rename the Administrator account and create a "dummy" "Adminstrator" account, disactivated with no rights. Couldn't find an easy way to do that, but why not: the registry is once again the answer. Thanks.

...Yes, the easiest way to do the HKCU stuff is here. You could always log on as the administrator, modify the default users account, delete all users profiles, log on to a new user with adminstrator rights, delete the administrator's profile, and the result would be nearly the same, but I digress...

The fade effect, small iscons, etc, can easily be exported into .reg files, and imported, avoiding the copying NTUSER.DAT.

Link to comment
Share on other sites

I am a small time system builder so an unattended xp install is superb for me. I do a clean install maybe 10 times a week. I need to leave administrator open as the "ejots" I supply do incredible things to their PC's and I need to get at them quickly.

Your points about clean install and adjusting hive I already adhere to but definitely the thing to do.

My goal is to have a totally automated process that I can give to the customer should they make a mess so they can reinstall painlessly with full tweaks as I like. I know 8 months down the line it will be out of date but it is a starting block for them.

Getting the visual tweaks for the user and changing power policy to always on is really all i am left with to do besides a few silent install of appz so thanks for your head up.

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
  • Recently Browsing   0 members

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