Sign in to follow this  
Followers 0
cdorobantu

USB Device in WinPE

25 posts in this topic

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.

Share this post


Link to post
Share on other sites



Whats WinPE? Windows Personal Edition? Oo


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

You will need DevCon command line from M$.

DevCon rescan

With the rescan switch it will check for new plug and play devices, as long you have the drivers included on WinPe.

Go to this link to download DevCon


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

@Danny35d,

How do I use the Diskpart tool? Do you know the command line to re-mount the drive and assign a drive letter?

Thanks a lot!

Share this post


Link to post
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!

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

You are right. My BartPe is build with Windows 2003 Server. Diskpart from windows xp doesn't have automount.

Edited by Danny35d

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

Danny35d,

I just tried what you posted in WinPE and it does not list the volume. The only two options that I get when I type LIST VOLUME are: Volume 0 (the CD-ROM) and Volume 1 (the internal HDD). The external USB drive is not listed.

Share this post


Link to post
Share on other sites

You are right. My BartPe is build with Windows 2003 Server.

Maybe, if I build my WinPE with the same then it might work... I'm not sure that I can though...

Thanks for all your help! ;)

Share this post


Link to post
Share on other sites

a work around for diskpart automount will be:

3) Type Bartpe -pnp or DevCon rescan


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Try with WinBuilder

www.boot-land.net

Is WinBuilder not a OS on its own? Same as BartPE? How would I use this?

Share this post


Link to post
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
Sign in to follow this  
Followers 0