萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> 編程語言綜合 >> VBScript 監控磁盤更改事件實現代碼

VBScript 監控磁盤更改事件實現代碼

這篇文章主要介紹了如何用vbs實現監控磁盤更改事件,需要的朋友可以參考下  

來自微軟官方,寫USB小偷腳本是最好不過的了

復制代碼 代碼如下:


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")
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

copyright © 萬盛學電腦網 all rights reserved