VBScript 监控磁盘更改事件实现代码
(编辑:jimmy 日期: 2024/11/15 浏览:3 次 )
来自微软官方,写USB小偷脚本是最好不过的了
复制代码 代码如下:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService. _
ExecNotificationQuery("Select * from Win32_VolumeChangeEvent")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
Wscript.Echo objLatestEvent.DriveName
Wscript.Echo objLatestEvent.EventType
Wscript.Echo objLatestEvent.Time_Created
Loop
下一篇:vbs 脚本错误:操作中文件名或类名未找到的解决方法