Win2003 to refresh the hardware list with the command line to scan the implementation code for hardware changes _vbs

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.