Jump to content

Still having problems with $oem$


Recommended Posts

Hello All,

I followed everyones advise on my last post and i still am having no luck with the $oem$ folders, it seems that the files are not being copied to the harddrive.

My Files are as follows:

Cmdlines.txt

[COMMANDS]

"runonceex.cmd"

Winnt.sif

OemPreinstall=Yes

Runonceex.cmd

PP=%cdrom%\Apps\

I dont know what is going wrong, my cd root has the three folders, i386; Apps; $oem$. Any more help you guys can give?

thanks,

briar

Link to comment
Share on other sites


Right now just $$ which has the system32 folder and inside that reg.exe and cmdow.exe. will add more later when i get this part right. heres another clue i noticed...when i double click on the runonceex.cmd, it doesnt add the information to the registry. attached is the file although i think these are two seperate problems.

Link to comment
Share on other sites

I'm not sure why the reg entries aren't being added, but I know that if you run the script within Windows itself, it doesn't work properly - you get an "%%i not expected at this time" error, and that may be why the reg entries are not being added (just an educated guess, though, not 100% certain).

Congratulations, you really made me think about this one! After a few hours of tinkering (yes, I'm terribly single-minded when it comes to "simple" problems like this :)) I think I have something better to find a CD Drive letter, as well as making it persistent outside of this batch. This may be more useful in the long run, rather than checking in every batch, and you could conceivably use it in any batch file or script once this vbscript has been run. You'd have to run this AFTER Windows setup has complete, because WMI won't be available yet (at least not with reliable data) during Windows setup - it's something you could run in a RunOnceEx parameter, then reboot and do the rest via RunOnceEx again. If you use the AutoLogon feature of your WINNT.SIF file, you should be able to set the AutoLogonCount value to the number of required reboots for this to work (one for the vbscript, and one for each time you would've otherwise needed a reboot). Sorry it's not as easy to get up and running as a FOR IF SET query, but I never do things the easy way if I think they might not work every time :rolleyes:.

Anyway, here's the vbscript code you need to run first, before running your batch file:

Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Setup"
objReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
("Select * from Win32_CDROMDrive")
For Each objItem in colItems
strDrive = objItem.Drive
Set colFiles = objWMIService.ExecQuery _
("Select * From CIM_DataFile Where FileName = 'win51ip' " & _
"AND Extension = 'sp2' AND Drive = '" & strDrive & "'")
If colFiles.Count > 0 Then
For Each objFile in colFiles
strEntryName = "CDDRIVE"
strValue = objItem.Drive
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strEntryName,strValue
Next
End If
Next

This script puts the CD drive letter in the registry as a value of "CDDRIVE", and it does so for whatever CD contains the win51ip.sp2 file (a file on the root of a Windows XP SP2 CD). After this has been run, you can just query this reg entry in your batch to set the variable, as so:

%systemdrive%
cd\temp

reg query hklm\software\microsoft\windows\currentversion\setup /v cddrive > cddrive
for /f "tokens=3 skip=3" %%1 in (cddrive) do set cddrive=%%1

You would now have a variable called %cddrive% - note that the variable will only be a drive letter and a colon, no backslash (D:, not D:\).

Blasted "easy" scripts - nothing is ever as easy as it seems. I should've known better... :yes: Oh, and watch out for word wrap on the scripts - it seems the board software wraps some of the lines, at least at 1280x1024.

Edited by cluberti
Link to comment
Share on other sites

Thank you for the script, but as i am new to all this, im assuming this is why the Apps folder isn't copied over to the harddrive?

also, i was able to hit pause on my keyboard while the runonceex.cmd was executing and the message that is repeating is "Too many command line parameters". what does that mean, is it just because it is executing inside windows or is there a problem that needs fixing?

Link to comment
Share on other sites

The Apps folder as you described above is not inside $oem$\$1 so it won't be copied. Not that it matters with the runonceex.cmd you posted anyway as that sets the progs to be run from <CD>:\Apps\...

There is nothing in the cmd you posted to cause 'too many parameters' errors.

edit:

In fact here is the results

for /f "tokens=3 skip=2" %%i in (
'REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v SourcePath'
) do set cdrom=%%~di

SET PP=%cdrom%\Apps\

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installing Programs" /f

REG ADD %KEY%\000 /VE /D "Paint Dot Net" /f
REG ADD %KEY%\000 /V 1 /D "%PP%PaintNET.exe" /f

REG ADD %KEY%\001 /VE /D "Daemon Tools" /f
REG ADD %KEY%\001 /V 1 /D "%PP%daemontool.exe" /f

REG ADD %KEY%\002 /VE /D "Directx 8.1 for Windows NT" /f
REG ADD %KEY%\002 /V 1 /D "%PP%DX81NTeng.exe /Q" /f

REG ADD %KEY%\003 /VE /D "Real Alternative" /f
REG ADD %KEY%\003 /V 1 /D "%PP%RealAlternative.exe /VERYSILENT /SP-" /f

REG ADD %KEY%\004 /VE /D "QuickTime Alternative" /f
REG ADD %KEY%\004 /V 1 /D "%PP%QuickTimeAlternative.exe /VERYSILENT /SP-" /f

REG ADD %KEY%\005 /VE /D "Quickpar Data Repair" /f
REG ADD %KEY%\005 /V 1 /D "%PP%QuickPar.exe" /f

REG ADD %KEY%\006 /VE /D "Microsoft Reader" /f
REG ADD %KEY%\006 /V 1 /D "%PP%MSReader.exe" /f

REG ADD %KEY%\007 /VE /D "Java Virtual Machine" /f
REG ADD %KEY%\007 /V 1 /D "%PP%jre505.exe" /f

REG ADD %KEY%\008 /VE /D "Mozilla Firefox" /f
REG ADD %KEY%\008 /V 1 /D "%PP%firefoxsilent.exe" /f

REG ADD %KEY%\009 /VE /D "Microsoft Dot Net 2.0" /f
REG ADD %KEY%\009 /V 1 /D "%PP%dotnet2.exe" /f

REG ADD %KEY%\010 /VE /D "Acrobat Reader 6.0" /f
REG ADD %KEY%\010 /V 1 /D "%PP%acroread604.exe" /f
pause

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx]
"TITLE"="Installing Programs"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\000]
@="Paint Dot Net"
"1"="L:\\Apps\\PaintNET.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\001]
@="Daemon Tools"
"1"="L:\\Apps\\daemontool.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\002]
@="Directx 8.1 for Windows NT"
"1"="L:\\Apps\\DX81NTeng.exe /Q"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\003]
@="Real Alternative"
"1"="L:\\Apps\\RealAlternative.exe /VERYSILENT /SP-"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\004]
@="QuickTime Alternative"
"1"="L:\\Apps\\QuickTimeAlternative.exe /VERYSILENT /SP-"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\005]
@="Quickpar Data Repair"
"1"="L:\\Apps\\QuickPar.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\006]
@="Microsoft Reader"
"1"="L:\\Apps\\MSReader.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\007]
@="Java Virtual Machine"
"1"="L:\\Apps\\jre505.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\008]
@="Mozilla Firefox"
"1"="L:\\Apps\\firefoxsilent.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\009]
@="Microsoft Dot Net 2.0"
"1"="L:\\Apps\\dotnet2.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\010]
@="Acrobat Reader 6.0"
"1"="L:\\Apps\\acroread604.exe"

Edited by nakira
Link to comment
Share on other sites

Thank you for the script, but as i am new to all this, im assuming this is why the Apps folder isn't copied over to the harddrive?

Um, Apps wasn't copied to hard drive because only folders in \$OEM$\$1 or \$OEM$\$$ are copied to the hard drive, where \$OEM$\$$ is a special folder that essentially means the C:\WINDOWS folder or the %SYSTEMROOT% environment variable.

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