Jump to content

Recommended Posts

Posted

This is the case

Im making a universal image and im very far.

sysprep -bmsd is ok ofcourse but it will not add entries to mass storage drivers of www.driverpacks.net. I need to do this by hand. Is someone capable to create a script that reads al the PCI etc entries from .inf files from the massstorage driverpacks and add them in a simulair way to the sysprep.inf [buildMassStorage] section as the sysprep -bmsd does?

this way I can automate it and I will share my ONE4ALL creator method here for you all!

same of [buildMassStorage] section in sysprep.inf

pci\ven_10aa&dev_0000=c:\windows\inf\machine.inf

pci\ven_1025&dev_1435=c:\windows\inf\machine.inf

pci\ven_10b9&dev_1445=c:\windows\inf\machine.inf

pci\ven_10b9&dev_1489=c:\windows\inf\machine.inf

pci\ven_10b9&dev_1449=c:\windows\inf\machine.inf

Please assist. I know that icemanND is very good with scripting.... ;-)


Posted

Are you just trying to add all of the PCI entries to the sysprep.inf or are you wanting to install the drivers to the OS also?

That script I helped you with oh so long ago will do the first. There are a few drivers in the pack which are not signed so you have to either click OK to a few hundred messages or I create an autoit script that watch for the message and clicked ok for me.

Posted

Hmm you are right you hwid.cmd script does this this is the code:

rem %1 is path to MassDriverPacks Folder
IF "%1"=="" GOTO EOF
IF NOT EXIST %1 GOTO EOF

SETLOCAL ENABLEDELAYEDEXPANSION
SET STDOUT=%cd%\HWIDS.TXT
TYPE>%STDOUT% 2>NUL

::traverse drivers path
CALL :TRAVERSAL %1

GOTO EOF

:TRAVERSAL
PUSHD %1
for /f %%f in ('Dir /b *.inf') do (
for /f "eol=- tokens=2 delims=," %%i in ('find /i "pci\ven" %%f') do (
for /f "tokens=*" %%j in ("%%i") do (
for /f "tokens=1* delims=_" %%k in ("%%j") do (
if /i "%%k" EQU "PCI\VEN" (
for /f "usebackq tokens=1* delims=; " %%a in ('%%j') do (
echo %%a=%cd%\%%f>>%STDOUT%
)
)
)
)
)
)

FOR /F %%I IN ('DIR /AD /OGN /B') DO (
CALL :TRAVERSAL %CD%\%%I
)
POPD
GOTO EOF

:EOF

Can you update this script to auto add the contents of hwid.txt directly under de [buildMassStorage] section of sysprep.inf

and what about the driver signing problem. Has anybody already solved this?

Posted

That just sets the devicepath in the sysprep file or registry. I'm talking about this one (slightly modified for my own use):

sysprep_run.cmd

@echo off
del /a /f /q sysprep.inf
del /a /f /q sysprep.mid
del /a /f /q hwids.txt

Call :Cleanup

setlocal enabledelayedexpansion

Echo Creating MassStorageSection of Sysprep.inf

rem change path of next statement to the path containing the masstorage drivers, this then creates hwids.txt
rem which contains the list of pci devices from the inf files.
Call :HWID c:\DP\M

rem this appends the hwids.txt to the end of a temporary sysprep file which contains all of the settings I want
Rem and ends with the [SysprepMassStorage] section header
copy sysprep.hold /a +hwids.txt /a sysprep.inf

rem in case anything had been added to the devicepath key in the past I reset it to the default.
reg add HKLM\Software\Mirosoft\Windows\CurreVersion /v DevicePath /t REG_EXPAND_SZ /d %windir%\inf; /f

Rem last chance to quit before sysprep runs
Echo Preparing to Run Sysprep
Echo.
Echo Last Chance to stop
Echo Press CTRL-C to exit or
Pause

rem add in the additional device paths's (replace with vernalex's tool if desired)
Echo Creating DevicePath in registry to additional drivers
SetDevicePath c:\DP

rem continue watches for the driversigning message boxes and clicks ok.
Start Continue.exe
rem dodn't remember why I added this, may not really be needed.
Start WatchDriverSigningPolicy.exe

Rem the server service must be started in order for sysprep 2.0 to run, my images all have it disable when
rem the systems are deployed. so here I enable and start the server service and then disable it, but it is
rem left running.
Echo Starting and disabling Server Service for Sysprep

sc config lanmanserver start= demand
sc start lanmanserver
sc config lanmanserver start= disabled

sysprep -reseal -mini -pnp -noreboot

pause

GOTO EOF

:HWID
rem %1 is path to MassDriverPacks Folder
IF "%1"=="" GOTO EOF
IF NOT EXIST %1 GOTO EOF

SETLOCAL ENABLEDELAYEDEXPANSION
SET STDOUT=%cd%\HWIDS.TXT
TYPE>%STDOUT% 2>NUL

::traverse drivers path
CALL :TRAVERSAL %1

GOTO EOF

:TRAVERSAL
PUSHD %1
for /f %%f in ('Dir /b *.inf') do (
for /f "eol=- tokens=2 delims=," %%i in ('find /i "pci\ven" %%f') do (
for /f "tokens=*" %%j in ("%%i") do (
for /f "tokens=1* delims=_" %%k in ("%%j") do (
if /i "%%k" EQU "PCI\VEN" (
for /f "usebackq tokens=1* delims=; " %%a in ('%%j') do (
echo %%a=%cd%\%%f>>%STDOUT%
)
)
)
)
)
)

FOR /F %%I IN ('DIR /AD /OGN /B') DO (
CALL :TRAVERSAL %CD%\%%I
)
POPD
GOTO EOF

:DriversPath
PUSHD %1
IF EXIST *.INF SET OemPnPDriversPath=!OemPnPDriversPath!;%CD:~3%
FOR /F %%I IN ('DIR /AD /OGN /B') DO (
CALL :DriversPath %CD%\%%I
)
POPD
GOTO EOF

:Cleanup
pushd c:\
for %%D in (C 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 %%D:\recycler (
CD /D %%D:\recycler
for %%F in ('Dir /ad /b') do rd /s /q "%%F" >> c:\cleanup.log
)
)
cd /d c:\
del /a /s /f /q *.pnf >> c:\cleanup.log
del /a /s /f /q *.tmp >> c:\cleanup.log
del /a /s /f /q infcache.* >> c:\cleanup.log
del /a /s /f /q "%windir%\temp" >> c:\cleanup.log

for /f "tokens=*" %%i in ('dir /s /a /b temp') do del /a /s /f /q "%%i" >> c:\cleanup.log
for /f "tokens=*" %%i in ('dir /s /a /b tempor*') do del /a /s /f /q "%%i" >> c:\cleanup.log

del /a /s /f /q "%temp%" >> c:\cleanup.log
del /a /s /f /q "%tmp%" >> c:\cleanup.log
popd
goto eof

:EOF

continue.exe autoit script code:

; <AUT2EXE VERSION: 3.1.1.0>

; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-START: continue.au3>
; ----------------------------------------------------------------------------

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author: IcemanND
;
; Script Function:
; Click Continue Anyway for hardware installation during sysprep
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here

do

while not (winexists ("Hardware Installation") or winexists ("Confirm File Replace") or winexists ("Installation Complete"))
wend

Sleep (100)

if winexists("Hardware Installation") then send("+{TAB}{ENTER}")
if winexists("Confirm File Replace") then send("{TAB}{ENTER}")
if winexists("Installation Complete") then send("{ENTER}")
until 1=2

; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-END: continue.au3>
; ----------------------------------------------------------------------------

Sysprep.hold

;SetupMgrTag
[Unattended]
OemSkipEula=Yes
TargetPath=\WINDOWS
InstallFilesPath=C:\sysprep\i386
KeepPageFile=0
UpdateInstalledDrivers=Yes
DriverSigningPolicy=Ignore
UpdateUPHAL="APCIAPIC_MP,%windir%\inf\hal.inf"

[GuiUnattended]
AdminPassword="password"
EncryptedAdminPassword=NO
AutoLogon=Yes
AutoLogonCount=5
OEMSkipRegional=1
OEMDuplicatorstring="Universal Intel Image 03/17/06"
TimeZone=35
OemSkipWelcome=1

[UserData]
ProductID=go get one somewhere else
FullName="company User"
OrgName="my company"
ComputerName=*

[SetupMgr]
DistFolder=C:\sysprep\i386
DistShare=windist

[Display]
BitsPerPel=32
XResolution=1024
YResolution=768

[TapiLocation]
CountryCode=1
Dialing=Tone
AreaCode=510

[Branding]
BrandIEUsingUnattended=Yes

[Proxy]
Proxy_Enable=0
Use_Same_Proxy=0

[Identification]
JoinWorkgroup=WORKGROUP

[Networking]
InstallDefaultComponents=Yes

[Sysprep]
BuildMassStorageSection=yes

[SysprepMassStorage]

Posted

Ok the thing that we need to find out is. Why this long process of adding drivers to de massstorage section. Why not just do it for windows... but how?

What process in taking place in the registry or files changes? when sysprep is run with this option?

IcemanND any idea on tracking this?

Posted

just ran sysprep on a vm, adding the massstorage controllers into the criticaldevicesdatabase key via sysprep with only the windows drivers resulted in adding 667 sub-keys. That doesn't include the associated values.

Probably can be done using either setupaip.dll or advpack.dll, but is it worth it? Could we do it any faster than sysprep already does?

Posted (edited)

What I already tried was this.

use SetupCopyOEMInf.exe to add the massstorage drivers to the windows\inf dir. this goes very fast even faster when you use your continue.exe

only I expected sysprep to now automatically add these to the massstorage section when I do sysprep -bmsd but this isn't the case. Sysprep seems to get this info from the machine.inf file and another inf file........

so maybe if we could add extra drivers to these machine.inf file we goed make the process faster.... what do you think?

P.s what was the critical devices key you found?

p.p.s Also I need a script that changes the HAL to standard PC HAL. Writes a key in the runonce to a script which updates the hal after image deployment backup to the right hal.

Edited by jeremyotten
Posted

when you run sysprep and build the mass storage section it adds all of those devices to the critical devices database in the registry.

HKLM\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase

Posted (edited)

OK I got the whole process automated with some help of you scripts and continue.exe files (had to change it so be compatible with dutch OS)

But. Are you able to add the entire www.driverpacks.net massstorage package with this method?

If yes please tell me how. Because sysprep seems to not be able to complete its process. And because I run it queit no error is displayed...

I got the error the error is

"An Error occured while trying to update your registry"

Reseal machine failed!

I found an article which claims its a faulty entry in the massstorage section

http://support.microsoft.com/kb/249690

Im looking at it know If I can find the entry (this is alot of work) Maybe if you already know which one it is. Please share....

;-)

Edited by jeremyotten
Posted

I manully start off my scripts but this could be automated.

Create a scheduled task for an interactive CMD window which starts one minute from current time. The command window runs under the System user account. Then run sysprep from this CMD window and you won't get that error.

This problem is supposedly related to a registry permissions issue but I never managed to find out just what caused it.

Posted (edited)

Can you tell me how to script and automate this scheduled task?

You would greatly help because im trying to make a 100 percent automated cd

maybe you can do something with this:

http://blogs.msdn.com/adioltean/articles/271063.aspx

OK after scripting myself silly I created this (should would right? or do you have a better option?)

@ECHO OFF
REM ---- SET HOURS BASED on 24U CLOCK------
time /t|FIND "01:">NUL
IF not ERRORLEVEL==1 SET UU=01
time /t|FIND "02:">NUL
IF not ERRORLEVEL==1 SET UU=02
time /t|FIND "03:">NUL
IF not ERRORLEVEL==1 SET UU=03
time /t|FIND "04:">NUL
IF not ERRORLEVEL==1 SET UU=04
time /t|FIND "05:">NUL
IF not ERRORLEVEL==1 SET UU=05
time /t|FIND "06:">NUL
IF not ERRORLEVEL==1 SET UU=06
time /t|FIND "07:">NUL
IF not ERRORLEVEL==1 SET UU=07
time /t|FIND "08:">NUL
IF not ERRORLEVEL==1 SET UU=08
time /t|FIND "09:">NUL
IF not ERRORLEVEL==1 SET UU=09
time /t|FIND "10:">NUL
IF not ERRORLEVEL==1 SET UU=10
time /t|FIND "11:">NUL
IF not ERRORLEVEL==1 SET UU=11
time /t|FIND "12:">NUL
IF not ERRORLEVEL==1 SET UU=12
time /t|FIND "13:">NUL
IF not ERRORLEVEL==1 SET UU=13
time /t|FIND "14:">NUL
IF not ERRORLEVEL==1 SET UU=14
time /t|FIND "15:">NUL
IF not ERRORLEVEL==1 SET UU=15
time /t|FIND "16:">NUL
IF not ERRORLEVEL==1 SET UU=16
time /t|FIND "17:">NUL
IF not ERRORLEVEL==1 SET UU=17
time /t|FIND "18:">NUL
IF not ERRORLEVEL==1 SET UU=18
time /t|FIND "19:">NUL
IF not ERRORLEVEL==1 SET UU=19
time /t|FIND "20:">NUL
IF not ERRORLEVEL==1 SET UU=20
time /t|FIND "21:">NUL
IF not ERRORLEVEL==1 SET UU=21
time /t|FIND "22:">NUL
IF not ERRORLEVEL==1 SET UU=22
time /t|FIND "23:">NUL
IF not ERRORLEVEL==1 SET UU=23
time /t|FIND "00:">NUL
IF not ERRORLEVEL==1 SET UU=00


REM --- SET AT 1 MINUTE AHEAD -----
time /t|FIND ":00">NUL
IF not ERRORLEVEL==1 at %UU%:01 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":01">NUL
IF not ERRORLEVEL==1 at %UU%:02 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":02">NUL
IF not ERRORLEVEL==1 at %UU%:03 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":03">NUL
IF not ERRORLEVEL==1 at %UU%:04 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":04">NUL
IF not ERRORLEVEL==1 at %UU%:05 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":05">NUL
IF not ERRORLEVEL==1 at %UU%:06 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":06">NUL
IF not ERRORLEVEL==1 at %UU%:07 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":07">NUL
IF not ERRORLEVEL==1 at %UU%:08 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":08">NUL
IF not ERRORLEVEL==1 at %UU%:09 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":09">NUL
IF not ERRORLEVEL==1 at %UU%:10 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":10">NUL
IF not ERRORLEVEL==1 at %UU%:11 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":11">NUL
IF not ERRORLEVEL==1 at %UU%:12 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":12">NUL
IF not ERRORLEVEL==1 at %UU%:13 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":13">NUL
IF not ERRORLEVEL==1 at %UU%:14 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":14">NUL
IF not ERRORLEVEL==1 at %UU%:15 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":15">NUL
IF not ERRORLEVEL==1 at %UU%:16 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":16">NUL
IF not ERRORLEVEL==1 at %UU%:17 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":17">NUL
IF not ERRORLEVEL==1 at %UU%:18 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":18">NUL
IF not ERRORLEVEL==1 at %UU%:19 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":19">NUL
IF not ERRORLEVEL==1 at %UU%:20 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":20">NUL
IF not ERRORLEVEL==1 at %UU%:21 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":21">NUL
IF not ERRORLEVEL==1 at %UU%:22 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":22">NUL
IF not ERRORLEVEL==1 at %UU%:23 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":23">NUL
IF not ERRORLEVEL==1 at %UU%:24 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":24">NUL
IF not ERRORLEVEL==1 at %UU%:25 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":25">NUL
IF not ERRORLEVEL==1 at %UU%:26 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":26">NUL
IF not ERRORLEVEL==1 at %UU%:27 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":27">NUL
IF not ERRORLEVEL==1 at %UU%:28 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":28">NUL
IF not ERRORLEVEL==1 at %UU%:29 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":29">NUL
IF not ERRORLEVEL==1 at %UU%:30 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":30">NUL
IF not ERRORLEVEL==1 at %UU%:31 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":31">NUL
IF not ERRORLEVEL==1 at %UU%:32 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":32">NUL
IF not ERRORLEVEL==1 at %UU%:33 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":33">NUL
IF not ERRORLEVEL==1 at %UU%:34 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":34">NUL
IF not ERRORLEVEL==1 at %UU%:35 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":35">NUL
IF not ERRORLEVEL==1 at %UU%:36 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":36">NUL
IF not ERRORLEVEL==1 at %UU%:37 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":37">NUL
IF not ERRORLEVEL==1 at %UU%:38 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":38">NUL
IF not ERRORLEVEL==1 at %UU%:39 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":39">NUL
IF not ERRORLEVEL==1 at %UU%:40 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":40">NUL
IF not ERRORLEVEL==1 at %UU%:41 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":41">NUL
IF not ERRORLEVEL==1 at %UU%:42 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":42">NUL
IF not ERRORLEVEL==1 at %UU%:43 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":43">NUL
IF not ERRORLEVEL==1 at %UU%:44 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":44">NUL
IF not ERRORLEVEL==1 at %UU%:45 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":45">NUL
IF not ERRORLEVEL==1 at %UU%:46 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":46">NUL
IF not ERRORLEVEL==1 at %UU%:47 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":47">NUL
IF not ERRORLEVEL==1 at %UU%:48 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":48">NUL
IF not ERRORLEVEL==1 at %UU%:49 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":49">NUL
IF not ERRORLEVEL==1 at %UU%:50 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":50">NUL
IF not ERRORLEVEL==1 at %UU%:51 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":51">NUL
IF not ERRORLEVEL==1 at %UU%:52 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":52">NUL
IF not ERRORLEVEL==1 at %UU%:53 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":53">NUL
IF not ERRORLEVEL==1 at %UU%:54 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":54">NUL
IF not ERRORLEVEL==1 at %UU%:55 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":55">NUL
IF not ERRORLEVEL==1 at %UU%:56 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":56">NUL
IF not ERRORLEVEL==1 at %UU%:57 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":57">NUL
IF not ERRORLEVEL==1 at %UU%:58 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":58">NUL
IF not ERRORLEVEL==1 at %UU%:59 /interactive "C:\sysprep\sysprep.bat"

time /t|FIND ":59">NUL
IF not ERRORLEVEL==1 at %UU%:00 /interactive "C:\sysprep\sysprep.bat"

UPDATE 30/5/2007

THE SCRIPT WORKS! gheghe thanks for the info. Only problem when I boot the system I get a nvata.sys loading error (NVIDIA? don't have it in my system) removed the D\M\N drivers from the process. And I am trying again...

Edited by IcemanND
Posted

OK I got rid of the nvata.sys error.

BUT NOW! I get an ntfs.sys error when loading windows after sysprep resealed it. Help is very needed!

Thanx in Advance

Posted

hate to say it but the only time I have ever seen that error it had to do with a failing hard drive.

Yes there is an easier way that that monster script of yours. I'm working on it now and will post it later.

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