mesale0077 Posted October 27, 2010 Share 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 Link to comment Share on other sites More sharing options...
willichan Posted October 27, 2010 Share 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. 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, Enigma, CornedBeef Hash 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