Jump to content

USB Device in WinPE


Recommended Posts

Hi,

I have made an AutoIt script that can detect a USB external HDD in WinPE, check its size and compare it to the internal HDD. If the external has less than the internal one, then the external disk will be formatted.

The problem that WinPE only detects the USB drive if I boot the computer with the drive connected. If I am already in WinPE and I plug in the USB drive then nothing happens.

Does anyone know how I can ask WinPE to scan through the USB ports and find the drive using an AutoIt script? I do not want to have to reboot every time I connect a USB drive to the computer because this runs from a CD so it takes a while.

Thanks.

Link to comment
Share on other sites

Whats WinPE? Windows Personal Edition? Oo

No, it is Windows Preinstallation Environment. It is a stripped down version of Windows that in my case, is based on Windows XP SP2. It is Microsoft's version of BartPE.

Edited by cdorobantu
Link to comment
Share on other sites

Thanks Danny35d, I will give this a try and post my results.

Your welcome. I know some WinPe user hate BartPe, but if you create your WinPe using Bart program you can also use BartPe.exe -pnp and it will do the same thing as DevCon. Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

Danny35d, I have tried the DevCon rescan command plus other alternatives of the same thing and no luck. I still need to reboot in order for WinPE to pick up the external driver.

Maybe there is no way; it's just that it would be nice if the USB storaged worked in PE the same way it works in Windows XP.

Would you know what the differences could be?

Link to comment
Share on other sites

Danny35d, I have tried the DevCon rescan command plus other alternatives of the same thing and no luck. I still need to reboot in order for WinPE to pick up the external driver.

Maybe there is no way; it's just that it would be nice if the USB storaged worked in PE the same way it works in Windows XP.

Would you know what the differences could be?

Sorry I haven't do this in along time, I forgot to mention the once you finish running DevCon rescan you need to use Diskpart and assing a drive letter to the usb hard disk.
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

Also check out http://www.911cd.net/forums/

For listing USB devices, I perfer http://www.jsifaq.com/SF/Tips/Tip.aspx?id=8496

DiskPart http://support.microsoft.com/kb/300415

I can tell you right now that scripting DiskPart is annoying... http://www.autoitscript.com/forum/index.ph...amp;hl=diskpart

However, once you get a drive letter, it should work. (Well, I use BartPE with a plugin that enables the diskmgmt.msc GUI and the drive works after the letter is assigned.)

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Also check out http://www.911cd.net/forums/

For listing USB devices, I perfer http://www.jsifaq.com/SF/Tips/Tip.aspx?id=8496

DiskPart http://support.microsoft.com/kb/300415

I can tell you right now that scripting DiskPart is annoying... http://www.autoitscript.com/forum/index.ph...amp;hl=diskpart

However, once you get a drive letter, it should work. (Well, I use BartPE with a plugin that enables the diskmgmt.msc GUI and the drive works after the letter is assigned.)

Thanks for your reply.

If I run a disk list in WinPE, I do not get the USB drive listed unless I reboot the machine with the USB drive already connected. I want to be able to reconnect the USB device without restarting the computer. Any suggestions on that?

Link to comment
Share on other sites

I don't have my WinPe CD here at work. I use my other cd build with BartPe. This is an easy way to do it.

Steps:

1) Open CMD or Command Prompt window.

2) Type Diskpart

3) At DISKPART> prompt comes out type automount

you will get a message saying "Automatic mounting of new volumes enabled."

4) Type Exit, to get out of diskpart.

5) Plug in usb hard disk or Thumbdrive

6)Type Bartpe -pnp or DevCon rescan

7) Open your fle manager (A43, FreeCommander, Explorer, etc.) and you will see the usb drive.

Note:

You can use diskpart in a batch file and everytime WinPe or Bartpe boot up it will enable automatic mounting of new volumes.

You can add the following line to WinPe (Startnet.cmd) or Bartpe (Autorun*_Diskpart.cmd)

Diskpart /s %WinDir%\System32\Diskpart.txt

Create a text file, called Diskpart.txt and add the following lines. Copy this file to I386\System32 folder.

automount

exit

Edit:

After posting and playing around with diskpart, found out once enabling automatic mounting you don't need Devcon.exe or Bartpe.exe

Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

All the preview post test were done using a Thumb drive or memory stick. I borrow my friend usd hard disk and apply the same steps from the preview post and didn't work.

Do the step 1 to 3 and then:

4) Plug in usb hard disk or Thumbdrive

5) Type List Volume

It will display a list with all the volume. Look at the one without a Drive Letter (second column).

6) Type Select Volume #

Where # is the volume number of the missing drive letter.

7) Type Assign

8) Type again Select Volume #

It will display a list with all the volume. Look for the drive letter.

9) Type Exit

Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

@Danny35d,

I tried following your instructions, but everytime I type the automount command, I just get a listing of what diskpart could do (same list as if I was typing HELP). Do you know why?

I was reading on the MS website and they were saying to use the diskpart automount enable command; but that does not work either? Does the diskpart version in XP not have this option?

Thanks

Link to comment
Share on other sites

Hi,

I have made an AutoIt script that can detect a USB external HDD in WinPE, check its size and compare it to the internal HDD. If the external has less than the internal one, then the external disk will be formatted.

The problem that WinPE only detects the USB drive if I boot the computer with the drive connected. If I am already in WinPE and I plug in the USB drive then nothing happens.

Does anyone know how I can ask WinPE to scan through the USB ports and find the drive using an AutoIt script? I do not want to have to reboot every time I connect a USB drive to the computer because this runs from a CD so it takes a while.

Thanks.

Try with WinBuilder

www.boot-land.net

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...