欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

VBScript 监控磁盘更改事件实现代码

程序员文章站 2022-04-10 13:41:36
来自微软官方,写usb小偷脚本是最好不过的了复制代码 代码如下: strcomputer = "." set objwmiservice = getobject("winm...

来自微软官方,写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