Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use vbs to determine the connection time of removable drives

Shulou Source: shulou.com Published: 2022-06-03 19:38:20 11月12日 Update

This article introduces the knowledge about "how to use vbs to determine the connection time of removable drives". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

The copy code is as follows:

strComputer = ". " Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colEvents = objWMIService.ExecNotificationQuery _ ("Select * From __InstanceOperationEvent Within 10 Where " _ & "TargetInstance isa 'Win32_LogicalDisk'") Do While True Set objEvent = colEvents.NextEvent If objEvent.TargetInstance.DriveType = 2 Then Select Case objEvent.Path_.Class Case "__InstanceCreationEvent" Wscript.Echo "Drive " & objEvent.TargetInstance.DeviceId & _ " has been added. " Case "__InstanceDeletionEvent" Wscript.Echo "Drive " & objEvent.TargetInstance.DeviceId & _ " has been removed. " End Select End If Loop"How to use vbs to determine the connection time of removable drives" is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Tags: Time driver mobile driver code content more knowledge practicality achievement next dilemma reality situation article case editing website industry process Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Apple Microsoft Shulou Technology Huawei