zigzagph Posted July 31, 2007 Share Posted July 31, 2007 I have created a bootable PE image and can boot it using a UFD. Everything works as expected except that I would like to access the .wim file located on UFD drive after the ram disk has been loaded. Does anyone know how to re-access the UFD drive or restart the USB port so the drive is assigned a drive letter? I have tried to use devcon and other scripting techniques but none have been successful at re-assigning the UFD a drive letter other then physically removing the drive and re-inserting it back into the port. Link to comment Share on other sites More sharing options...
zorphnog Posted July 31, 2007 Share Posted July 31, 2007 I haven't tried, but I would think a rescan command from the diskpart prompt should do the trick. Either way, diskpart.exe is the tool you should be using. Its built into PE and supports scripting so check it out. Link to comment Share on other sites More sharing options...
zigzagph Posted July 31, 2007 Author Share Posted July 31, 2007 Thanks for the reply. Unfortunately dispart rescan does not do the trick. Anyone else have any ideas?Thanks! Link to comment Share on other sites More sharing options...
p4ntb0y Posted August 9, 2007 Share Posted August 9, 2007 What version of winpe are you using?I could send you a vb script that assigns a drive letter via diskpart based on the label of the UFD so that you can script a automactic load of your wim works for me in winpe 2005 and winpe 2.In fact I dig it out from work tomorrow and post it here Link to comment Share on other sites More sharing options...
jaclaz Posted August 10, 2007 Share Posted August 10, 2007 (edited) Also you can try Uwe Sieber programs and info on DEVCON:http://www.uwe-sieber.de/usbstick_e.htmlhttp://www.uwe-sieber.de/usbdlm_e.htmljaclaz Edited August 10, 2007 by jaclaz Link to comment Share on other sites More sharing options...
p4ntb0y Posted August 10, 2007 Share Posted August 10, 2007 here is the vb script to set a driver letter to a disk/UFD based on the label of that device...Const ForReading = 1, ForWriting = 2, ForAppending = 8Dim WshShell, wshFSOSet WshShell = CreateObject("WScript.Shell")Set wshFSO = CreateObject("Scripting.FileSystemObject")' change these to customize the script...const msVolumeName = "kingston" ' i.e. Danconst msNewDriveLetter = "Q" ' i.e. Q' don't change these constants!const msDiskPartbatch = "runDP.bat" ' i.e. runDP.batconst msDiskPartLVScript = "dp_listv.txt"const msDPVolumesTemp = "diskvolumes.txt"' create scripts - nice and clean this waycall createDPScript(msDiskPartBatch)call createDP_LVscript(msDiskPartLVScript)' get the volumescall GetDiskVolumes(msDiskPartbatch, msDPVolumesTemp)' get the volume ID from the outputmiDiskID = getVolumeLetterAndIDfromFile(msDPVolumesTemp, msVolumeName)' change the letter....call GhangeDiskVolumes("changescript.txt", miDiskID, msNewDriveLetter)' clean up output files.....call deleteifexists(msDiskPartbatch)call deleteifexists(msDiskPartLVScript)call deleteifexists("diskvolumes.txt")call deleteifexists("changelog.txt")call deleteifexists("changescript.txt")' done.call msgbox("Done!")wscript.quitprivate sub DeleteIfExists(rsFileName) on error resume next if wshfso.fileexists(rsFileName) = true then wshfso.deletefile(rsFilename) end ifend subprivate sub createDP_LVScript(rsFileName) dim DPLVScriptFile ' write the file Set DPLVScriptFile = wshfso.OpenTextFile(rsFileName, ForWriting, true) DPLVScriptFile.writeline "list volume" DPLVScriptFile.closeend subprivate sub createDPScript(rsFileName) dim DPScriptFile ' write the file Set DPScriptFile = wshfso.OpenTextFile(rsFileName, ForWriting, true) DPScriptFile.writeline "@echo off" DPScriptFile.writeline "diskpart /s %1 > %2" DPScriptFile.closeend subprivate function getVolumeLetterAndIDfromFile(rsFileName, rsVolumeName) dim diskPartVolumes dim miDiskID, maLine dim mbFound Set diskPartVolumes = wshfso.OpenTextFile(rsFileName, ForReading, false) mbFound = false while diskPartVolumes.atendofstream = false maLine = split(diskPartVolumes.readline," ") 'msOut = "" 'for mi=1 to ubound(maline) ' msOut = msOut & mi & " - " & maline(mi) & vbcrlf 'next if ubound(maLine) > 11 then if ucase(maline(11)) = ucase(rsVolumeName) then 'msgbox "Volume " & rsVolumeName & " is on letter " & maline(8) & " thats volume no " & maline(3) miDiskID = maline(3) mbFound = true end if end if 'msgbox msOut wend if mbFound = true then getVolumeLetterAndIDfromFile = miDiskID else call msgbox("Unable to find volume " & rsVolumeName & " in " & rsFilename) end if diskPartVolumes.closeend functionprivate sub GetDiskVolumes(rsBatchfile, rsFileName) dim oExec Set oExec = WshShell.Exec(rsBatchfile & " " & msDiskPartLVScript & " " & rsFileName) Do While oExec.Status = 0 WScript.Sleep 500 Loopend subprivate sub GhangeDiskVolumes(rsFileName, riVolumeID, rsNewLetter) dim diskPartVolumes ' write the file Set diskPartVolumes = wshfso.OpenTextFile(rsFileName, ForWriting, true) diskPartVolumes.writeline "select volume " & riVolumeID diskpartvolumes.writeline "assign letter=" & left(rsNewLetter,1) diskpartvolumes.close ' execute dim oExec Set oExec = WshShell.Exec(msDiskPartbatch & " " & rsFileName & " changelog.txt") Do While oExec.Status = 0 WScript.Sleep 500 Loop end subjust change it to the letter and label you require. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now