Jump to content

Recommended Posts

Posted

Let me see if I understand this...

1) Both files (OEMClean.reg, OEMClean.bat) should be in my $OEM$\$$ dir (so that they are copied to windows\system32)

2) in my winnt.sif, I have:

[GuiRunOnce]
   %systemdrive%\install\WPI20b15\wpi.cmd
   regedit /S C:\Windows\System32\OEMClean.reg

3) My OEMClean.reg should be:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"OEMCleanup"="C:\\Windows\\System32\\OEMClean.bat"

4) My OEMClean.bat should be:

Deltree /Y C:\Install
Deltree /Y C:\Drivers
Deltree /Y C:\Windows\System32\OEMClean.reg
Deltree /Y C:\Windows\System32\OEMClean.bat
(or basically, my cleanup file)

Q1) Is this implemented correctly?

Q2) This should cause my wpi.cmd to run now, and my OEMClean to run AFTER my next startup (meaning AFTER I reboot the machine?) - namely, after all my programs install, then I reboot, then this runs?

Q3) Can I change my OEMClean.bat to be a ".cmd" file? (assuming I change all references of OEMClean.bat to OEMClean.cmd, will this still work?)


Posted

The way you have it would work if you want to delete it all the very next time you boot the computer. Myself, I have files in there I like to use until it's time to ship it out to the customer, so I use the GuiRunOnce to setup the batch files on the desktop, and then from there I use those batch files to setup the cleanup on next reboot. This is my GuiRunOnce:

[GuiRunOnce]

    Command0="C:\Windows\System32\OEMPrep.bat"

Which, as shown above, copies my bit.bat (Burn-In-Test batch file) and sysprep.bat to the All Users desktop. The OEMClean.bat file is run from the registry after you use sysprep.bat to add it in. And yes, it should work fine using OEMClean.cmd, I'm just old school and used to making batch files instead of cmd files :)

Technically, all of those files could be copied to the C:\OEM directory with everything else, but I wanted to make it easy to launch the files without having to specify the location. Just a personal preference. If you stick them all in C:\OEM, then you only need one line to delete all the files:

Deltree /Y C:\OEM

Meh, I may do this still tbh. Still working out how to make it best. A preinstallers work is never done, heh.

Posted

Ok, I finished making the changes I wanted. Could you look over this code, and make sure I applied it correctly?

winnt.sif

[GuiRunOnce]
   %systemdrive%\install\WPI20b15\wpi.cmd
   regedit /S %systemdrive%\install\cleanup.reg

cleanup.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"OEMCleanup"="%systemdrive%\\install\\cleanup.cmd"

cleanup.cmd

CLS
@echo off
TITLE Windows XP SP2 - Cleanup

ECHO.

shutdown.exe -r -f -t 60 -c "Windows XP will now restart in 1 minute..."


ECHO Deleting Default Users of XP (Remote User, Help User, .NET User)...
start /wait net user helpassistant /delete
start /wait net user SUPPORT_388945a0 /delete
start /wait net user ASPNET /delete

ECHO Deleting Installation Shortcuts...
//Standard Crap
RD /S /Q "%AllUsersProfile%\Start Menu\Programs\PrintMe Internet Printing"
RD /S /Q "%AllUsersProfile%\Start Menu\Programs\Java Web Start"
DEL "%AllUsersProfile%\Start Menu\Programs\Windows Movie Maker.lnk"
DEL "%UserProfile%\Start Menu\Programs\Remote Assistance.lnk"

//Adobe Reader 6.0
DEL "%AllUsersProfile%\Desktop\Adobe Reader 6.0.lnk"

//AIM
DEL "%AllUsersProfile%\Desktop\Free AOL & Unlimited Internet.lnk"
DEL "%AllUsersProfile%\Start Menu\Free AOL & Unlimited Internet.lnk"
DEL "%AllUsersProfile%\Desktop\AOL Instant Messenger.lnk"
DEL "%UserProfile%\Application Data\Microsoft\Internet Explorer\Quick Launch\AOL Instant Messenger.lnk"

//Daemon Tools
MOVE "%AllUsersProfile%\Desktop\DAEMON Tools.lnk" "%UserProfile%\Start Menu\"

//TuneUp 2004
RD /S /Q "%UserProfile%\Start Menu\Programs\TuneUp Utilities 2004"
DEL "%UserProfile%\Desktop\1-Click Maintenance.lnk"

//Winamp
DEL "%UserProfile%\Application Data\Microsoft\Internet Explorer\Quick Launch\Winamp.lnk"
DEL "%UserProfile%\Desktop\Winamp.lnk"

//WinRAR
DEL "%UserProfile%\Start Menu\winrar.lnk"


ECHO Deleting Sample Music, Playlists, and Pictures...
RD /S /Q "%AllUsersProfile%\Documents\My Music\Sample Music\"
RD /S /Q "%AllUsersProfile%\Documents\My Music\Sample Playlists\"
RD /S /Q "%AllUsersProfile%\Documents\My Pictures\Sample Pictures\"


ECHO Deleting Preset Internet Explorer Favorites...
RD /S /Q "%UserProfile%\Favorites\"


ECHO Deleting Temp Installation Files...
RD /S /Q %systemdrive%\Drivers
RD /S /Q %systemdrive%\Install
RD /S /Q "%systemroot%\Cache\Adobe Reader 6\"


EXIT

the cleanup.cmd is also deleting some shortcuts from programs which should be installed on the FIRST BOOT. As I understand this method, cleanup.cmd will run on the SECOND BOOT. Is this correct?

Thanks!!!

(PS - my cleanup.reg and cleanup.cmd are in "$OEM$\$1\Install\" )

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...