MD5: A1784DF802FF7970D0D956BC45DCD7B5
Last Update: 04/11/2006
Mirror - At the very bottom of this post, I made an in-post attachment as a mirror of the main file download. My hosting service, DreamHost, seems to be going down on a semi-regular basis these days.
Change Log - Also at the bottom of this post.
If you have ever installed Windows XP SP2 straight from the CD that you received from Microsoft, then you probably realize that going about it from scratch can take up the better part of your day. If you are reading this, then you have probably already discovered RyanVM's Windows XP Post SP2 Update Pack, nLite, WPI, xPlode, and maybe even have come up with a few tricks of your own. What I've discovered in the last several years are that there is always something that still needs to be done even when it's "done".
What I've tried to do with this collection of scripts is sew up some of the remaining holes in the process. This collection consists of VBscripts that I've put together over the last couple of years. Some of the code I came up with ages ago and have adapted it for public consumption. Some of the code is relatively new. Some of it I got from others and made only small modifications. Through this document, I will make every effort to link to where I found a specific set of code and give credit where it's due.
Included is batch file, presetup.cmd, one VBscript for cmdlines.txt called cmdlines.vbs, the cmdlines.txt that launches cmdlines.vbs, and then several VBscripts for use during RunOnceEx. You don't need to know one thing about VBscript in order to use these either. All of the user defined settings are contained in one file, 500_Settings.ini. The filenames are such that they correspond with the RunOnceEx step number. I took this a little further and named files which are manipulated during a particular stage and gave them a similar prefix. For instance, the script 070_VMwareTools.vbs installs the VMware Tools. So the filename of the switchless silent installer that the script calls is named 071_VMwareTools.exe. This way your \OEM directory will be full of files that are listed in the order which they are processed. Here is what a full directory would look like:

This entire set of scripts were designed to work with either a CD/DVD based install or a RIS based install. For RIS installations, all of the files need to be placed in the \$OEM$\$1 directory in your RIS image. If there is a particular script that you don't want to use, just leave it out. That's it. So if you don't want to be bothered with defragmenting your hard drive during the install, just omit the script(s) that perform that function. I also made provisions for adding your own custom scripts. You can insert up to two custom scripts during the first run of RunOnceEx, and then up to four custom scripts during the second run (after the first set of RunOnceEx reboots). And these don't even have to be scripts. You could always insert an installer file or whatever else you would normally run from RunOnceEx. So without further delay, on to the "how to" part of all this.
presetup.cmd
This batch file is a drop in replacement for the batch used in a Method 2 installation of Bashrat the Sneaky's DriverPacks. This will work with either CD/DVD or RIS installs. I also added the ability to decompress two specific 7-Zip archive files, 000_SystemDrive.7z and 000_WinDir.7z. As you may have guessed, 000_SystemDrive.7z is decompressed to %SystemDrive% and 000_WinDir.7z to %SystemRoot%. And here's a little trick I use on CD base installs where you only have 700MB to utilize: I take all of the RunOnceEx scripts, 101_Registry.reg, SetDevicePath.exe, and WatchDriverSigningPolicy.exe and compress them into 000_SystemDrive.7z. Sure, one could argue the savings is minimal, but sometimes all you need is that one extra megabyte to make your CD complete.
For RyanVM Integrator and nLite users, I made an addon that you can use to automatically place the files and make the appropriate entries to txtsetup.sif and dosnet.inf. You can get it here: http://ryanvm.net/fo...opic.php?t=1960
If you'd like a sample 000_WinDir.7z, you can download a version that I use. It contains a several visual styles (requires a patched uxtheme.dll) with corresponding wallpapers and it also has the latest Intel Chipset Driver .inf files conveniently placed in the \INF directory.
- 000_WinDir.7z - 11.7MB
MD5: C3AFB035FA03FE275669E828B78EDC50
The included cmdlines.txt has one line and that is to execute the cmdlines.vbs script. This script, like all of the other scripts, will first determine if the working directory is the \OEM directory of your CD/DVD or the %SystemRoot%. After that it checks to see what necessary files are available for use with RunOnceEx. The first four files that the script checks for are switchless silent installers that I've made:
- 010_dotNET20.exe - 15.9MB - Microsoft .NET Framework Runtime V2.0
MD5: 28E872B839DF683B8B5B06A28B547286 - 020_VJ#20.exe - 5.91MB - Microsoft Visual J# Runtime V2.0
MD5: EEDD42E469EFBEE43A89A31F1A2394D3 - 030_WSE30.exe - 650KB - Microsoft Web Services Enhancements V2.0 SP3 and V3.0 Runtimes
MD5: 466C94C0AB82C1298D6A1212F66F8BC2 - 050_DAEMONTools.exe - 2.20MB - This download contains two installers. The first installer, SPTD.exe, must be executed from svcpack.inf
MD5: 12437CCBF4F5E2E941F61022E2FCCA79
In the 500_Settings.ini file, the very first section [cmdlines] contains a few settings that you can set to suit your needs.
[cmdlines] CompressThreshold=10 CopySourceThreshold=40These values represent gigabytes. The CompressThreshold value as shown above, will enable the RunOnceEx script, 120_Compress.vbs, to run if the %SystemDrive% is found to be 10GB or less. The CopySourceThrehold value as shown, will enable the 110_CopySource.vbs script to run if the %SystemDrive% is found to be 40GB or larger.
Custom130File=130_Student-Streets.vbs Custom130Title=Student and Streets Custom140File=140_CreateShortcuts.vbs Custom140Title=Create ShortcutsThese entries are where you can define your custom installs or scripts. I've filled in the Custom entries to reflect the two custom scripts that I have included as examples. If are not going to include any custom entries, then replace what I have entered with the word None.
DL1Name=ActiveX.7z DL1URL=http://www.EarlyMorningHours.net/Files/ActiveX.7z DL2Name=Cookies.7z DL2URL=http://www.EarlyMorningHours.net/Files/Cookies.7z DL3Name=Domains.7z DL3URL=http://www.EarlyMorningHours.net/Files/Domains.7zThese entries allow you to specify up to three registry files archived with 7-Zip for download and application. The 7-Zip files will be downloaded and decompressed. The extracted registry files will be merged into the registry and then all of the .7Z and .reg files will be deleted. These three files are currently available and you can leave the entries as they are if you would like to use them. If for instance you wanted to download the first and third files only, replace the values for DL2Name and DL2URL with the word None. The registry entries in these files represent a combination of the most recent entries made by Spybot S&D and SpywareBlaster. Lastly, you can place a registry file named cmdlines.reg in $OEM$ and it will be merged as well. Or to take it one step further, you could compress cmdlines.reg to cmdlines.7z and that will automatically be decompressed and merged. Please note that the code for downloading files was adapted from a script example found here: http://cwashington.n....asp?Index=1080
LogonDomain=%computername% LogonPassword=password LogonUserName=AdministratorThese entries are where you define the AutoLogon account information. If you are not going to be using a domain account, then leave the LogonDomain entry as %computername%.
060_VPN.vbs
This script will determine the chassis type of the computer it is running on and based on what type it is, it will execute up to two installers.
Installer1=061_AirCard.exe Installer2=062_CiscoVPN.exeInstaller1 and Installer2 represent the filenames of your installers that want to run based on the conditions you set. You can download the installer I made for the Sierra Wireless AirCard 555, but I am unable to provide the Cisco VPN Client installer due to licensing and strong encryption export restrictions.
- 061_AirCard.exe - 2.30MB
MD5: 5F30597CF0CDD48EE46EF92AF334BC5C
[VPN] Other=No Unknown=No Desktop=No LowProfileDesktop=No PizzaBox=No MiniTower=No Tower=No Portable=Yes Laptop=Yes Notebook=Yes Handheld=Yes DockingStation=Yes AllInOne=No SubNotebook=Yes SpaceSaving=No LunchBox=No MainSystemChassis=No ExpansionChassis=No SubChassis=No BusExpansionChassis=No PeripheralChassis=No StorageChassis=No RackMountChassis=No SealedCasePC=NoThese are the chassis types recognized by Windows Management Instrumentation (WMI). Please be advised that not all computer and laptop manufacturers properly adhere to these values - particularly a lot of "no name" brands. This script has so far worked for me on Dell, HP-Compaq, and Toshiba laptops. Your mileage may vary.
070_VMwareTools.vbs
This script will determine, via WMI, whether or not the "computer" that you are running your install on is actually a VMware Workstation virtual machine. It does this by checking the appropriate BIOS string where VMware had populated the field with their company name. If it is determined to be a virtual machine, the script will execute a switchless silent installer, 071_VMwareTools.exe, that installs the VMware Tools. The script does not have any entries in 500_Settings.ini.
- 071_VMwareTools.exe - 3.12MB
MD5: BA06EF25320E613CC032649046C7D6ED
This script will selectively keep device drivers from Bashrat the Sneaky's DriverPacks and register the path in the registry. You must have the DriverPack 7-Zip archive files decompressed either as a normal part of a Method 2 install, or you can use the directory created by a Method 1 slipstream. This script depends on SetDevicePath.exe which must be located either in the root of %SystemDrive% or in the \OEM directory of your CD/DVD install source.
[KtD] SourceDir=%SystemDrive%\D DestinationDir=%SystemRoot%\DThe entries are critical to the proper execution of this script. If you enter the path improperly, the script won't go hunting around to find your driver directory. The SourceDir value must begin with either %SystemDrive%, %systemRoot%, or %cdrom%. The DestinationDir value must begin with either %SystemDrive% or %SystemRoot%. Whatever you put in after that is up to you, just so long as it actually reflects where your source really is (or will be). You can make the SourceDir and DestinationDir values the same.
CompressFiles=YesThis entry indicates whether or not you want cab (makecab) the compressable files within the drivers. I've found that this saves a considerable amount of space and institues an imperceptable performance penalty when your computer finds a new device.
[KtD-List] ;Chipset C ;CPU CPU ;Graphics G ;Lan L\AD L\AU ...etc.At the very bottom of 500_Settings.ini is a list of directories that you do NOT want to keep. The default list that I created will remove drivers that do not support devices based on USB, FireWire, or PCMCIA. The logic is that we don't add PCI cards that frequently, but plug in hot devices all the time. Feel free to modify this list as you wish.
100_Cleanup.vbs
This is the script that is going to need the most amount of updating right off the bat. I plan on making the Start Menu cleanup and other cleanup chores much more customizable via the .ini file, but at some point I had to say "when" and finally release a version 1.0.
The first thing that is done is that up to two 7-Zip archives are decompressed. If 101_AllUsers.7z is found, it will be decompressed to %AllUsersProfile%. In some circumstances I throw in some shortcuts to Start Menu or the Desktop folders. If 101_ProgFiles.7z is found, it will be decompressed to %ProgramFiles%. If a registry file named 101_Registry.reg is found, it will be merged.
The first cleanup performed looks for files in the root of %SystemDrive% to delete. These would be the switchless silent installers starting with 010_dotNET20.exe and so on. So, let's get into the settings.
[Cleanup] CleanAllUsersStartMenuYN=Yes CleanUserStartMenuYN=Yes DelWindowsCatalog=Yes DelSetPrograms=Yes DelMovieMaker=Yes DelAccAccessibility=Yes DelAccCommunications=Yes DelAccEntertainment=Yes DelAccSystemTools=YesThese entries all have to do with the Start Menu. All of the entries beginning with "Del" indicate shortcuts or subfolders of Accessories that are to be deleted from the All Users Start Menu and are dependant on the CleanAllUsersStartMenuYN entry. The CleanUserStartMenu entry when enabled deletes all shortcuts and the Accessories subfolder from the User Start Menu. This will not prevent creation of shortcuts to the User Start Menu from the registry (ex: \Accessories\Address Book).
RestrictStartMenuYN=Yes Folder0=Hardware Folder1=Security Folder2=Utilities Folder3=These entries are the names of subfolders in the All Users Start Menu that you would like to lock down so that only administrators can view the contents. An annoying aspect to this is that restricted users can still see the subfolders in the Start Menu, even though they can't see any of the shortcuts. You may define up to ten (10) folder names to restrict (0 thru 9). In order for these entries to be processed, CleanStartMenu must be set to Yes.
CleanDefaultUserYN=YesWhen this is set to Yes, the following directories are deleted from the Default User profile: Desktop, My Documents, NetHood, PrintHood, Recent, Start Menu, and Templates. This is strictly personal preference, but I prefer that the only thing that is derived from the Default User profile, be the registry. I like to place shortcuts, etc in the All Users profile so I know that they will be there for everyone.
CleanLogFilesYN=YesWhen this is set to Yes, all of the .log files in %SystemRoot% are compressed to a 7-Zip archive called SetupLogFile.7z. They are then deleted along with any extraneous .tmp files.
110_CopySource.vbs
This script will be registered into the RunOnceEx sequence based on the size of your hard drive relative to the value entered for CopySourceThreshold (see the [cmdlines] section). This script will look to see if there is a Windows XP install CD in the drive. If found it will copy the i386 directory to %SystemRoot%\i386 and register the location. All executable files in the svcpack directory are deleted from the local source.
120_Compress.vbs
This script will be registered into the RunOnceEx sequence based on the size of your hard drive relative to the value entered for CompressThreshold (see the [cmdlines] section). Directories that are not often accessed in %SystemRoot% and %ProgramFiles% are compressed using NTFS compression. This yields a pretty modest space savings, but with so many laptops hobbled with 30GB (or less) hard drives, I like to get all the space I can.
130_Student-Streets.vbs
This is an example script that I threw in one of the slots for a user custom script. I put in here to demonstrate a couple of things. With Streets & Trips, there is an example of how you can use .msi installers directly within VBscript without the need to invoke an instance of the command interpreter. The code for installing Student is a demonstation of what you can do in VBscript using AutoItX.dll. Just keep in mind that you need to register the AutoItX.dll file prior to running the script.
140_CreateShortcuts.vbs
This is another example script. The only thing it does is create shortcuts based on whether or not the target programs are installed.
150_DefragHD.vbs
This script will defragment the hard drive(s). It will look to see if PerfectDisk is installed and if it is that will be used instead of Windows Defrag. For offline defrags without PerfectDisk, SysInternal's PageDefrag is utilized. Due to licensing restrictions, I am unable to supply this freeware title with the distribution of these scripts. You can download it from SysInternals directly at http://www.sysintern.../PageDefrag.zip. If want to use PageDefrag, make sure that it's executable is somewhere in the system path.
[DefragHD] OfflineDefrag=YesThe OfflineDefrag setting is a simple Yes or No. It probably doesn't warrant any further explanation than that. If anyone wants me to implement support for Diskeeper or O&O, send me a PM so I can ask you for some information.
160_ConfigPageFile.vbs
The sole purpose of this script is to set your page file to a static size. By default, the size is set to two times the amount of physical RAM you have in your computer.
[ConfigPageFile] SizeRelativeToRAM=2
170_ConfigAccounts.vbs
Almost all of the functions in this script are optional and/or configurable. With everything set to Yes here is what happens: The builtin Administrator account is renamed, disabled, description deleted, and joined to the Guests local group. The builtin Guest account is renamed and the description deleted. A fake Administrator account is created, complete with the default description, joined to the local Guest group and set to disabled. The user registry for the currently logged in user is exported to the Default User profile. A fellow on MSFN with the screen name of BoaSoft gave me the idea for the code to copy the current HKCU to the Default User profile. The original thread is here: http://www.msfn.org/...showtopic=64605.
The script will now take on of two branches of execution. If it finds a file named 171_NameSettings.hta, it will execute that file which brings up a simple interface asking you to enter in the user name, full name, and password (w/ confirm) of an Administrative User and a Restricted User. Additionally you are asked to give the computer a name. This is nice since you put whatever want in your WINNT.SIF file and use the same source on multiple computers. The AutoLogon entries will be populated with credentials of whatever you enter for the Administrative User. This option meant for computers that not domain members. Removing Internet Explorer from your install may prevent the .hta file from executing.
The other branch of execution is a simple subroutine and will execute if 171_NameSettings.hta is not found. You need to configure the three entries below that begin with Logon if you want the computer to AutoLogon and complete the second series of RunOnceEx entries. This option can be used for computers that are either domain or workgroup members.
[ConfigAccounts] BuiltinAdminName=Jerry BuiltinGuestName=Kramer DelASPNET=Yes DelHelpAssistant=Yes DelSUPPORT=Yes FakeAdminYN=Yes LogonDomain=%computername% LogonPassword=password LogonUserName=Administrator ProcessAdminYN=Yes ProcessGuestYN=YesThe options above should be self-explanatory. The entries DelASPNET, DelHelpAssistant, and DelSUPPORT will delete the extra builtin (and mostly useless) accounts.
180_WiFi.vbs
This script is still under developement.
190_SetNextBoot.vbs
Just like with cmdlines.vbs, this script populates the RunOnceEx registry entries based on what scripts it finds available. You can specify up to four custome scripts or executables to run. The syntax for defining your custom RunOnceEx entries is the same as with cmdlines.vbs. The script will then optionally defragment the registry using NTRegOpt and then reboot. NTRegOpt can be downloaded here: http://www.larsheder...online.de/erunt. Just make sure it's couple of files are within the system's path. I usually put it in %SystemRoot%\System32.
[SetNextBoot] Custom210File=None Custom210Title=None Custom220File=None Custom220Title=None Custom230File=None Custom230Title=None Custom240File=None Custom240Title=None DefragRegistry=Yes
200_ConfigNetwork.vbs
This script performs a few common network configuration chores. I will enable the tray icon for your primary (wired) network connection, rename the connection from "Local Area Connection" to a name of your chosing, hardcode a DNS suffix for your primary connection (this is the box in Advanced TCP/IP settings, DNS Tab, towards the bottom), turn off NetBIOS for ALL network connections, and set your wired connection to a fixed 100-Full Duplex. Thanks to Cluberti for pointing this thread: http://www.codecomme...sage723253.html. I adapted code from there for the speed and duplex routine.
[ConfigNetwork] ConnectionName=Local Area Connection ShowTrayIcon=Yes Domain= NetBIOS=Off SetSpeed=YesA couple of notes. I have this script run in the second round of RunOnceEx because the Cisco VPN Client needs a reboot before it's virtual NIC can be enumerated. I think the same goes for VMware Workstation (though I always install that from svcpack.inf anyway). This way I am sure NetBIOS will be disabled from any virtual NICs. If you want to rename the primary connection and set a DNS suffix, you must set ShowTrayIcon to Yes.
250_FinalDefrag.vbs
See the description for 150_DefragHD.vbs. I like to run a second hard disk defrag because with PerfecDisk at least, it doesn't seem to collect the boot optimizing information until the reboot after the first RunOnceEx scripts run.
[FinalDefrag] OfflineDefrag=Yes
300_Final.vbs
This script simply clears out the AutoLogon registry entries, deletes the 500_Settings.ini file, and then reboots the computer.
999_Template.vbs
This is a totally nonfunctioning script. It's a stipped down shell of how most of my scripts start out. All of the basics are in there to get you started on your way to making your own custom scripts. If you need some help with proper syntax, chances are you'll be able to find an example to help you out in one of my scripts. I am not even nearly qualified with scripting expertise to be able to write a scripting tutorial, so that's not what I'm attempting to do here. I'm just trying to illustrate that it's not so scary or difficult, and that anybody who wants to learn how, can quite easily. There are just tons of resources out there, a good deal of them free, that can help you to learn to script in Windows. Hopefully this collection of scripts will inspire a few people out there to come up with their own time savers and works of art. Please feel free to share your creations with others here in this thread.
Version 1.02 - 04/11/2006
- presetup.cmd - Wildcards implemented for dealing with 000_SystemDrive.7z and 000_WinDir.7z files. This way you can have multiple files of each, for instance differentiating between work sites. Ex: 000_SystemDrive-CompanyA.7z or 000_SystemDrive-Home.7z.
- cmdlines.vbs V1.02 - AutoLogon entries in workgroup and domain situations not working for some users. Both issues fixed.
- 100_Cleanup.vbs V1.01 - Start Menu cleanup has been broken up between All Users and the User Start Menu. The All User Start Menu cleanup routine is now highly customizable from 500_Settings.ini. Restricting certain Start Menu folders to Admin only access will now accept up to 10 custom folder names and is now seperate from the Start Menu cleanup routine.
- 170_ConfigAccounts.vbs V1.01 - Same issues as cmdlines.vbs.
- 171_NameSettings.hta V1.01 - Same issues as cmdlines.vbs.
- 200_ConfigNetwork.vbs V1.01 - I discovered that not all NICs populate the registry entry for ComponentID the same way. The NIC detection code has been modified to properly detect all NICs. This change required changes to 500_Settings.ini. Also, support for two more NICs added.
- cmdlines.vbs - There was a typo involving the RunOnceEx registry entries for custom script entries at the 140 level. Fixed.
- 110_CopySource.vbs - The source path was being registered as %systemroot%\i386 instead of %systemroot%. To work properly the entry needs to read up to but not including the i386 folder. Also, there were two registry entries for the source path that I was not populating. Both problems fixed.
- Thank you to Moonlight Sonata for pointing out both errors and providing working fixes. Talk about service
- Each script will contain a change log at the very bottom, after all code. This will hopefully make for better tracking of changes.
Attached File(s)
-
ScriptPack_V102.7z (21.35K)
Number of downloads: 616
This post has been edited by RogueSpear: 20 April 2006 - 08:59 PM



Help

Back to top




















