mesale0077 14 Posted October 27, 2010 hi drive letter for partitions new usb info When I added a new usb, new usb dont show partitions When I added second a new usb ,, old usb shows partitions expandcollapse popup$strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colEvents = $objWMIService.ExecNotificationQuery _ ("Select * From __InstanceOperationEvent Within 5 Where " _ & "TargetInstance isa 'Win32_LogicalDisk'") While 1 $objEvent = $colEvents.NextEvent If $objEvent.TargetInstance.DriveType = 2 Then Select Case $objEvent.Path_.Class()="__InstanceCreationEvent" Consolewrite("Drive " & $objEvent.TargetInstance.DeviceId & "has been added." & @CR) newusbinfo() Case $objEvent.Path_.Class()="__InstanceDeletionEvent" Consolewrite("Drive " & $objEvent.TargetInstance.DeviceId & "has been removed."& @CR) EndSelect EndIf $objEvent = $colEvents.NextEvent If $objEvent.TargetInstance.DriveType = 3 Then Select Case $objEvent.Path_.Class()="__InstanceCreationEvent" Consolewrite("Drive " & $objEvent.TargetInstance.DeviceId & "has been added." & @CR) newusbinfo() Case $objEvent.Path_.Class()="__InstanceDeletionEvent" Consolewrite("Drive " & $objEvent.TargetInstance.DeviceId & "has been removed."& @CR) EndSelect EndIf WEnd func newusbinfo() Local $Drive = $objObject.TargetInstance.DeviceId $drv &= $objObject.TargetInstance.Description & " " &$Drive & " " & _ $objObject.TargetInstance.FileSystem &" VOL: " & _ $objObject.TargetInstance.VolumeName & @CRLF msgbox(0,"_new usb info_ ", $drv) return endfunc Share this post Link to post Share on other sites
willichan 220 Posted October 27, 2010 Are you on a network with mapped drives? Sometimes windows doesn't look to see if a drive letter is already in use when an external drive is added. Check "My Computer" and see if there is a unique drive letter assigned to the USB drive. If not, go to the disk management utility to change the drive letter that the USB device is assigned to one that is not already in use. Join me in supporting Pediatric Therapy Network through Amazon Smile. My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator Share this post Link to post Share on other sites