#RequireAdmin Global $strComputer = "." Global $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" Msgbox(0,"angeschlossen", "da") Case $objEvent.Path_.Class()="__InstanceDeletionEvent" msgbox(0,"abgeschlossen","Ab") ExitLoop EndSelect EndIf WEnd