Jump to content

oemlife

Member
  • Posts

    1
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

About oemlife

oemlife's Achievements

0

Reputation

  1. DISCLAIMER: This is my first post, please forgive me if I mess it up somehow. I'm also an amateur so my code sucks, but for me it gets the job done. I faced a similar problem. I found that WinPE was assigning a different drive letter to the USB drive. The way I figured out which was my usb drive was to query WMI for drive sizes, since I know how big it is. I looked for a drive bigger than 10GB and smaller than 20GB. Fortunately this logic works in my environment. Another assumption is that there's only one drive that size plugged into the server. I have no idea what a for each loop would do if it found more than one. I don't imagine it can assign the value to the string multiple times. Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery( _ "SELECT * FROM Win32_DiskDrive WHERE Size < 21474836480 AND Size > 10737418240",,48) For Each objItem in colItems strDID = (Right(objItem.DeviceID,1)) After I have the physical drive number assigned to the variable i dynamically generate my diskpart script to assign the usb drive letter to U: I suppose it's ghetto, and I'm not sure why I don't just look for the actual byte count of the usb drive. Edit: I don't have the actual code with me at home. I'll see if I can post it tomorrow.
×
×
  • Create New...