Topic: Script to create the MSD section for a given extracted MassStorage DP
Carsten Giese, Lead Technical Architect at Symantec, sent me the following script via the contact form. I hope some of you can use it Thanks Carsten!
Hello, driverpack-team,
I have written a nice sysprep.inf-creator to create the MSD-section with a given extracted MSD-driverpack.
You may distribute the script "as it is" on your download-area.The script does not need a sysprep-environment.
You just have to run on top of an extracted DriverPack MassStorage and it will create the output file.Here is the code of indexMSDs.vbs:
'24.03.2009, carsten_giese@symantec.com 'This script creates an index of all supported devices found in a driver-library and writes it into "sysprep_MSD.inf" 'The inf-file can be used to add the required lines into sysprep.inf of the master-Image Set fso = CreateObject("Scripting.FileSystemObject") Set WsShell = Wscript.CreateObject("WScript.Shell") scriptpath = fso.GetFile(wscript.ScriptFullName).ParentFolder 'Create busy-file set handle = fso.OpenTextFile(scriptpath & "\busy",2,true) handle.WriteLine input handle.Close dim line set inf = fso.OpenTextFile(scriptpath & "\sysprep_MSD.inf",2,true) rootfolder=scriptpath & "\" getFolderContent (rootfolder) inf.close fso.DeleteFile(scriptpath & "\busy") '-------------------------------------------- Function GetFolderContent(Directory) 'on error resume next 'if permission denied Dim fso, folder, filename,section,component,section2,component2 dim pnpcache,pnpid,typ,ven,dev,sys,rev,oempath Set fso = CreateObject("Scripting.FileSystemObject") Set folder = fso.GetFolder(Directory) oempath=lcase(right(directory,len(directory)-len(rootfolder))) For Each file In folder.Files filename = lcase(file.name) if right(filename,4)=".inf" then line=getFileContent(directory & file.name) manufacturer="" lastdevice="" pnpsection=0 pnpcache="," for i=0 to ubound(line) comment=instr(line(i),";") if comment>0 then line(i)=left(line(i),comment-1) if manufacturer="" then if instr(line(i),"[manufacturer]")>0 then i=i+1 section=split(line(i),"=") component=split(section(1),",") manufacturer=trim(component(0)) m1="[" & manufacturer & "]" m2="[" & manufacturer & "." end if else 'manufacturer <> "" if left(line(i),1)="[" then 'new inf-section pnpsection=instr(line(i),m1) + instr(line(i),m2) 'PNP-section found elseif pnpsection>0 then 'get PnPID from this line if instr(line(i),"=")>0 then section2=split(line(i),"=") component2=split(section2(1),",") for device=1 to ubound(component2) pnpid=ucase(component2(device)) pnpid=trim(replace(pnpid,vbTab,"")) if instr(pnpcache,"," & pnpid & ",")=0 then devicename = getDeviceName(section2(0)) inf.writeline pnpid & "=c:\drv\" & oempath & filename & devicename pnpcache = pnpcache & pnpid & "," end if next end if end if end if next inf.writeline end if Next For Each foldername in folder.SubFolders GetFoldercontent(Directory & foldername.name & "\") Next Set fso = nothing Set folder = nothing End Function function getFileContent(file) dim f,stream,cache set f = fso.GetFile(file) set stream = f.OpenAsTextStream(1,0) cache = stream.Read(f.Size) stream.close if instr(cache,"[Manufacturer]")=0 then cache="" getFileContent = split(lcase(cache),vbCrLf) set f = nothing set stream = nothing end function function getDeviceName(str) dim i,l,s1,s2,stringsection str=trim(replace(str,vbTab,"")) if instr(str,"%")>0 then str=replace(str,"%","") s1="[strings]" s2="[strings." for i=0 to ubound(line) if left(line(i),1)="[" then stringsection=instr(line(i),s1) + instr(line(i),s2) elseif stringsection>0 then if instr(line(i),str)>0 then l=line(i) str=trim(split(l,"=")(1)) end if end if next end if getDeviceName=" ; " & replace(ucase(str),"""","") end function
Which results in an output file (sysprep_MSD.inf) like this:
PCI\VEN_13C1&DEV_1002&SUBSYS_100213C1=c:\drv\m\3\3waredrv.inf ; AMCC 3WARE 9500S SATA RAID CONTROLLER PCI\VEN_13C1&DEV_1003&SUBSYS_100313C1=c:\drv\m\3\3waredrv.inf ; AMCC 3WARE 9550SX/9590SE SATA RAID CONTROLLER PCI\VEN_13C1&DEV_1004&SUBSYS_100413C1=c:\drv\m\3\3waredrv.inf ; AMCC 3WARE 9650SE SATA RAID CONTROLLER PCI\VEN_13C1&DEV_1004&SUBSYS_100513C1=c:\drv\m\3\3waredrv.inf ; AMCC 3WARE 9690SE SATA/SAS RAID CONTROLLER SCSI\PROCESSOR__AMCC__SATA_RAID_9500S_=c:\drv\m\3\3wmanage.inf ; AMCC SATA RAID 9500S MANAGER SCSI\PROCESSOR__AMCC__SATA_RAID_9550SX=c:\drv\m\3\3wmanage.inf ; AMCC SATA RAID 9550SX/9590SE MANAGER SCSI\PROCESSOR__AMCC__SATA_RAID_9650SE=c:\drv\m\3\3wmanage.inf ; AMCC SATA RAID 9650SE MANAGER SCSI\PROCESSOR__AMCC__SATA_RAID_9690SA=c:\drv\m\3\3wmanage.inf ; AMCC SATA RAID 9690SA MANAGER <snip> PCI\VEN_1106&DEV_3164&CC_0101=c:\drv\m\v3\vminiide.inf ; VIA BUS MASTER IDE CONTROLLER - 3164 PCI\VEN_1106&DEV_0581&CC_0101=c:\drv\m\v3\vminiide.inf ; VIA BUS MASTER IDE CONTROLLER - 0581 PCI\VEN_1106&DEV_5324&CC_0101=c:\drv\m\v3\vminiide.inf ; VIA BUS MASTER IDE CONTROLLER - 5324 PCI\VEN_1106&DEV_C409&CC_0101=c:\drv\m\v3\vminiide.inf ; VIA BUS MASTER IDE CONTROLLER - C409 PCI\VEN_104B&DEV_1040=c:\drv\m\vm\vmscsi.inf ; VMWARE SCSI CONTROLLER
Last edited by Wim Leers (2009-06-22 22:14:36)