O script (parcialmente comentado) funciona no ambiente Windows e não consigo prever a interação kace k1000 :
option explicit
On Error GoTo 0
Dim strResult, strComputer, wmi, wmiEvent , objWMIService, objItem, colItems, objEventObject
strComputer = "."
Set objWMIService = GetObject("winmgmts:\" & strComputer _
& "\ROOT\CIMV2\Security\MicrosoftVolumeEncryption") ' requires elevation
Set wmi = GetObject("winmgmts:\" & strComputer & "\root\cimv2")
' //check instant event for Logical Disk detection
Set wmiEvent = wmi.ExecNotificationQuery( _
"select * from __InstanceOperationEvent within 1 " _
& "where TargetInstance ISA 'Win32_LogicalDisk'")
While True
'' tell the script to wait until the next event of interest occurs
Set objEventObject = wmiEvent.NextEvent()
Select Case objEventObject.Path_.Class
Case "__InstanceCreationEvent"
'//check to see if the drive is encrypted
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_EncryptableVolume",,48)
For Each objItem in colItems
If objItem.ProtectionStatus = 0 then
strResult = strResult & vbNewLine & ":" & _
objEventObject.TargetInstance.Description & _
": Unencrypted drive " & objItem.DriveLetter
End If
Next
Case "__InstanceDeletionEvent" '' merely for debugging
strResult = strResult & vbNewLine & ":" & _
objEventObject.TargetInstance.Description & ": An event was just deleted"
End Select
If strResult <> "" Then Wscript.Echo Wscript.ScriptName & vbNewLine & strResult
strResult = ""
Wend
'' REMARK ''
'' //check instant event for usb detection
'' -- unsuccessful as 'TargetInstance.Description' could vary for different drives
' Set wmiEvent = wmi.ExecNotificationQuery( _
' "select * from __InstanceOperationEvent within 1 " _
' & "where TargetInstance ISA 'Win32_PnPEntity'" _
' & " and ( TargetInstance.Description='USB Mass Storage Device'" _
' & " or TargetInstance.Description='USB Flash Memory'" _
' & " or TargetInstance.Description='Disk drive')")
Aqui está uma explicação completa: Como posso monitorar diferentes tipos de eventos com apenas um script e Como posso determinar quando uma unidade removível é conectada