If you want to search for new hardware, you really don't know what command to use. System PnP can automatically search for new hardware, so there is no need to manually refresh the search.
If you want to see the changes in the device, you can use the command line to implement it.
method One, using WMIC (WMI command line)
Using WMIC requires administrator privileges, which are installed and configured the first time it is run.
Run the following command to save the driver list in the system to Sysdriver.txt:
Copy Code code as follows:
WMIC Sysdriver get DisplayName >sysdriver.txt
Run again, then use FC to determine if there is a change
Copy Code code as follows:
WMIC Sysdriver get DisplayName >sysdriver1.txt
FC Sysdirver.txt Sysdriver1.txt
method Two, using WMI scripts
You can use the JS or VBS to run scripts without administrator privileges.
The following methods can be used to get the Driver class table and then use FC to compare the results of the two run:
Copy Code code as follows:
cscript//nologo Sysdriver.vbs >sysdriver.txt
Sysdriver.vbs content is as follows
Copy Code code as follows:
VBScript Code
On Error Resume Next
Const wbemflagreturnimmediately = &h10
Const wbemFlagForwardOnly = &h20
StrComputer = "."
Set objWMIService = GetObject ("winmgmts://" & StrComputer & "/root/cimv2")
Set colitems = objWMIService.ExecQuery ("SELECT * from Win32_SystemDriver", "WQL", _
wbemFlagReturnImmediately + wbemflagforwardonly)
For each objitem in colitems
WScript.Echo Objitem.displayname
Next