vigorman Posted November 11, 2007 Share Posted November 11, 2007 (edited) I do search but no answer. my source code which is fine in windows xp sp2: expandcollapse popup#include <array.au3> MsgBox(64, "", "driver letter is:" & StringLeft(@ScriptDir,2) & "drive type is:" & DriveGetType(StringLeft(@ScriptDir,2))) $drives = _GetUSBDrives() For $i=0 to UBound($drives)-1 $usbdrv=$usbdrv & $drives[$i] & " " Next $usbdrv=StringReplace($usbdrv,"0","") $firstU=StringReplace(StringLeft($usbdrv,3)," ","") MsgBox(64, "", "first u is: " & $firstu) Func _GetUSBDrives() Local $aDletters[1] $strComputer = "." Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") Local $colDiskDrives = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive") For $objDrive In $colDiskDrives If $objDrive.pnpdeviceid <> RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum", _ RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum","count")-1) then Continueloop $strDeviceID = StringReplace($objDrive.DeviceID, "\", "\\") Local $colPartitions = $objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_DiskDrive.DeviceID=""" & _ $strDeviceID & """} WHERE AssocClass = " & _ "Win32_DiskDriveToDiskPartition") For $objPartition In $colPartitions Local $colLogicalDisks = $objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_DiskPartition.DeviceID=""" & _ $objPartition.DeviceID & """} WHERE AssocClass = " & _ "Win32_LogicalDiskToPartition") For $objLogicalDisk In $colLogicalDisks _ArrayAdd($aDletters,$objLogicalDisk.DeviceID ) Next Next Next Return $aDletters EndFunc but if in PE (1.1) it gives: Variable must be of type "Object" could somebody help? thanks a million. Edited November 11, 2007 by vigorman Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 11, 2007 Share Posted November 11, 2007 I do search but no answer.my source code which is fine in windows xp sp2:but if in PE (1.1) it gives:Variable must be of type "Object"could somebody help?thanks a million.Which variable? $objWMIService, $colDiskDrives, $objDrive, $colPartitions, etc...? Where is is failing? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
JerryD Posted November 11, 2007 Share Posted November 11, 2007 (edited) Windows PE doesn't have WMI support.You can try XPE Plugin with BartPE, but I haven't been able to get it to work yet! Edited November 11, 2007 by JerryD Link to comment Share on other sites More sharing options...
MadBoy Posted November 11, 2007 Share Posted November 11, 2007 Windows PE doesn't have WMI support.You can try XPE Plugin with BartPE, but I haven't been able to get it to work yet!Win PE 2.0 have WMI support. So just use newer version My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
vigorman Posted November 12, 2007 Author Share Posted November 12, 2007 Thanks to everybody. I will try pe 2.0. 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